我有一个非常奇怪的问题与git和github。当我试着推的时候,我得到:

git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

我添加了遥控器:

git remote add origin git@github.com:account-name/repo-name.git

什么好主意吗?


当前回答

如果您确定已经拥有对这个存储库的SSH访问权限。

Do

git clone https://myusername@github.com/path_to/myRepo.git

其他回答

如果使用私有存储库检查连接用户,则该用户必须具有使用存储库的权限。

我也遇到过同样的问题,是私人回购。

做以下几点:

移除远端原点

git remote rm origin

重新添加原点,但与您的用户名和PWD与写权限在这个PVT回购

git remote add origin  https://USERNAME:PASSWORD@github.com/username/reponame.git

只需使用SSH远程url,而不是HTTPS

在我的情况下,这是因为我在另一个GitHub帐户也添加了相同的SSH密钥。检查和修复步骤

检查它:ssh -T git@github.com。如果显示了正确的用户名,那么问题就不同了。如果是另一个帐户,则执行步骤2。 简单地去另一个帐户,并删除ssh密钥从那里。 不同的帐户使用不同的密钥。Github把它们搞混了。

我得到了同样的错误

ERROR: Repository not found.   
fatal: The remote end hung up unexpectedly

我在Github上创建了存储库,并在本地克隆了它。

我可以通过打开.git/config并删除[remote "origin"]部分来解决。

[remote "origin"]   
   url = git@github.com:alexagui/my_project.git  
   fetch = +refs/heads/*:refs/remotes/origin/*

然后我运行以下程序(再次)

git remote add origin git@github.com:alexagui/my_project.git  
git push -u origin master

这一次我可以推到存储库。