我有一个非常奇怪的问题与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不熟悉你的存储库。

Error:在git cli中提示如下:

remote:未找到存储库。致命:库 “https://github.com/MyOrganization/projectName.git/”未找到

解决方案:2个选项

Github might not familiar with your credentials: - The first Option is to clone the project with the right credentials user:password in case you forgot this Or generate ssh token and adjust this key in your Github. aka git push https://<userName>:<password>@github.com/Company/repositoryName.git Repo Permissions Issue with some users - In my Use case, I solved this issue when I realized I don't have the right collaborator permissions on Github in my private repo. Users could clone the project but not perform any actions on origin. In order to solve this:

去Github上的仓库->设置->合作者和团队->添加 成员/维护你的用户->现在他们获得了提交的权限 ,推动

其他回答

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

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

有类似的问题。问题的根源是我遵循了一些关于向Github添加新存储库的在线教程。

只要去Github,创建一个新的repo,它会要求你添加一个README,不要添加它。创建它,你会得到如何推送的指导。

它类似于接下来的两行:

git remote add origin https://github.com/YOUR_USER/your-repo.git
git push -u origin master

我在更新ubuntu到下一个版本后遇到了同样的错误

我刚刚删除了我的sshkey在github帐户,然后重新添加了一个sshkey到该帐户。

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

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

我的解决办法是:

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

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