我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
我得到了同样的错误
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
我在Github上创建了存储库,并在本地克隆了它。
我可以通过打开.git/config并删除[remote "origin"]部分来解决。
[remote "origin"]
url = git@github.com:alexagui/my_project.git
fetch = +refs/heads/*:refs/remotes/origin/*
然后我运行以下程序(再次)
git remote add origin git@github.com:alexagui/my_project.git
git push -u origin master
这一次我可以推到存储库。
其他回答
我也遇到了同样的问题,尝试了很多方法,但最后,我知道我没有足够的权限来推或拉这个回购,还有一种方法来检查你是否有权限,你无法看到该回购中的设置选项,如果你有权限,那么你将能够看到设置选项
谢谢!这是我观察到的
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管理员能够在短时间内授予我的团队写访问权 好不容易,我终于把树枝推了上去。
如上Alex所说,更改.git/config文件的内容会有所帮助。我也遇到了同样的问题,我想这是因为我更改了我的Github用户名。无法使用更改更新本地文件。所以当你改变你的用户名时,你可能会考虑跑步
Git远程添加原点your_ssh_link_from_github
我希望这对你有所帮助;)
在使用MacBook Pro时遇到了同样的问题。
当我尝试克隆一个存储库时,我得到以下错误:
git clone https://github.com/mytech/mytech_frontend.git
Cloning into 'mytech_frontend'...
remote: Repository not found.
fatal: repository 'https://github.com/mytech/mytech_frontend.git/' not found
以下是我的解决方法:
问题是我已经在我的电脑上设置了我的个人GitHub帐户,我试图克隆的存储库是个人的私人存储库(而不是团队帐户)。
我所要做的就是通过进入项目设置,将我的个人Github帐户添加为存储库中的合作者之一。之后我就可以克隆这个项目了。
我的解决办法是:
git remote rm origin
git remote add origin https://USERNAME@github.com/username/reponame.git
类似于Emi-C的答案,但没有密码。