我有一个非常奇怪的问题与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

什么好主意吗?


当前回答

这也可能发生,因为GitHub本身宕机了。一定要检查stat.github.com,看看问题是否在他们那边。

2018年10月22日,你有好几个小时都无法推送到GitHub。

其他回答

我得到了同样的错误,因为我改变了我的github用户名,然后我这样做:

git remote -v

然后:

git remote set-url newname newurl 
git push -u origin master

这次我能够推送到存储库。 我希望这能有所帮助。

如果你使用https从github克隆,但你使用ssh推送,你也会得到这个错误。

要纠正这个问题,打开.git/config并替换:

Url = https://github.com/company/project.git

With

Url = git@github.com:company/project.git

你应该可以在没有任何警告的情况下推…

我也遇到过类似的问题。错误的凭据缓存在OS X的密钥链中。

查看:https://help.github.com/articles/updating-credentials-from-the-osx-keychain

eval "$(ssh-agent -s)"

这是我自己的回购——应该有足够的使用权。对于其他回购,我能够拉和推没有问题。通过重新启动ssh-agent解决了这个问题。我用macos。

下面为我解决了这个问题。

首先,我使用这个命令来确定使用的github帐户是什么:

ssh -T git@github.com

这给了我一个这样的答案:

Hi <github_account_name>! You've successfully authenticated, but GitHub does not provide shell access. I just had to give the access to fix the problem.

然后我明白了答案中描述的Github用户(github_account_name)在我试图拉的Github存储库上没有授权。