我有一个非常奇怪的问题与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帐户是什么:

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存储库上没有授权。

其他回答

为了解决这个问题(在Linux上),我只需要运行这个:

git config --global --unset credential.helper

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

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

我也有同样的问题。试试下面的方法: 1. 修改密钥链访问在Mac的git凭证解决了我的问题。 2. 重置原始url

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

所以对我来说,我的密码有一个'(勾),PhpStorm在发送git推送之前删除了这个字符:

在这个例子中,我的密码是_pa ' ' ssword_

Phpstorm将输出以下内容:

https://_username_:_password_@github.com/_username_/repo.git

而不是

https://_username_ _pa“ssword_@github.com/_username_/repo.git

将密码更改为不使用'字符的密码。工作! !

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

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