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

什么好主意吗?


当前回答

如果你在vscode之前所有的东西都自动化了,现在它不再工作了,试着在vscode上注销你连接的github帐户,然后再登录到有权访问该存储库的正确的github帐户。

这里是你签出和签回的地方。

其他回答

如果有人在github.com上遇到这个问题,检查你是否接受了回购所有者允许提交给你的邀请。直到你接受邀请,回购将是无形的为您。所以你会得到ERROR: Repository not found。

我的解决办法是:

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

类似于Emi-C的答案,但没有密码。

如果你在Windows上使用Git,试着清除你的凭证:

找到“凭据管理器”(应该在控制面板中) 删除所有与GitHub相关的凭证

这解决了我的问题。

   git pull https://myusername:mypassword@github.com/path_to/myRepo.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存储库上没有授权。