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

什么好主意吗?


当前回答

使用Ubuntu时,我总是需要使用SSH而不是HTTPS添加远程

git remote add origin git@github.com:username/project.git

而不是

git remote add origin https://github.com/username/project.git

其他回答

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

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

对我来说,这些回答都没用。 我只是忘记在远程(github.com)上创建回购。所以我在网上创建了我的回购,用同样的名字,然后重新做

所以,这是整个故事:

git init ...
git add ...
git commit ...
git remote add origin git@github.com:<myName>/<myRepo>.git
git push -u origin main

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这里你需要在github.com上添加你的回购,使用相同的“myRepo”名称

git push -u origin main 

如果您包括您的用户名和回购名称,我们可以合理地帮助您,目前我们没有理由认为回购确实存在。

此外,如果回购是私有的,并且您无法访问它,github将返回“不存在”,以避免披露私有回购的存在。

编辑:如果你不能克隆它,因为它说它不存在,它是私有的,这是因为你没有发送身份验证。确保您的公钥已添加到密匙环,或暂时使用HTTP基本身份验证。

问题:由于某些原因,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本身宕机了。一定要检查stat.github.com,看看问题是否在他们那边。

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