我有一个非常奇怪的问题与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
什么好主意吗?
我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
我也遇到过类似的问题。错误的凭据缓存在OS X的密钥链中。
查看:https://help.github.com/articles/updating-credentials-from-the-osx-keychain
其他回答
remote:未找到存储库。可能是一个令人沮丧的误导错误消息从github试图推到HTTPS远程,你没有写权限。
检查您对存储库的写权限!
尝试SSH远程到相同的存储库显示不同的响应:
% git remote add ssh git@github.com:our-organisation/some-repository.git
% git fetch ssh
From github.com:our-organisation/some-repository
* [new branch] MO_Adding_ECS_configs -> ssh/MO_Adding_ECS_configs
* [new branch] update_gems -> ssh/update_gems
% git push ssh
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
“正确的访问权限?”
那你为什么不早说?
此时值得注意的是,虽然SSH失败模式在此场景中 稍微好一点,我使用HTTPS远程超过SSH,因为 GitHub推荐HTTPS over SSH。
我知道GitHub使用“未找到”的意思是“禁止”在一些 环境防止不经意间泄露了一个私人的存在 存储库。
需要身份验证的请求将返回404 Not Found,而不是 在某些地方是禁止的。这是为了防止意外泄漏 未授权用户的私有存储库。
——GitHub
这在网络上是一种相当普遍的做法,实际上它是这样定义的:
404(未找到)状态代码表示未找到原始服务器 目标资源的当前表示形式或不愿意 揭露它的存在。
——6.5.4。404未找到,RFC 7231 HTTP/1.1语义和内容(重点挖掘)
对我来说毫无意义的是,当我使用一个GitHub认证 凭据助手 并且我可以访问该存储库(已经成功地克隆和获取 它),GitHub会选择隐藏它的存在对我因为失踪 写权限。
通过网络查看https://github.com/our-organisation/some-repository/ 浏览器确认我没有写存储库的权限。我们的 团队的GitHub管理员能够在短时间内授予我的团队写访问权 好不容易,我终于把树枝推了上去。
我有这个问题,意识到我使用的是一个不同的帐户,其回购是。以原始用户身份登录解决了该问题。
对我来说,这些回答都没用。 我只是忘记在远程(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帐户是什么:
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存储库上没有授权。
我在使用Android Studio时遇到了同样的问题,由于身份验证错误,我无法推送提交。
我的临时解决方案是使用GitHub桌面应用程序来推送我的提交,它工作得很好。