我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
我得到这个错误(但之前正在工作)。我的问题是缺少与Github帐户绑定的ssh密钥。您可以使用ssh-add -l检查当前的ssh密钥。
如果你的钥匙丢失了,你可以用
ssh-add ~/.ssh/your_key
其他回答
所以对我来说,我的密码有一个'(勾),PhpStorm在发送git推送之前删除了这个字符:
在这个例子中,我的密码是_pa ' ' ssword_
Phpstorm将输出以下内容:
https://_username_:_password_@github.com/_username_/repo.git
而不是
https://_username_ _pa“ssword_@github.com/_username_/repo.git
将密码更改为不使用'字符的密码。工作! !
我的一个Github库也有同样的问题。
方法:
使用SSH而不是HTTPS,然后推/拉开始工作正常。
我也有同样的问题。我的问题是误解,我必须先在github上创建空的回购,然后再推到它。哎!包括这个给那些没意识到的人。
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管理员能够在短时间内授予我的团队写访问权 好不容易,我终于把树枝推了上去。
转到你的项目文件夹,然后搜索。git文件夹,然后用记事本打开配置文件,检查是否有你的链接到github回购下:[remote "origin"],如果它是不同的,然后在你的github回购,然后编辑它,或在配置文件中打开一个新的回购名称