Permission denied (publickey). fatal: The remote end hung up unexpectedly 解决办法
来源:互联网 发布:用python写网络爬虫 书 编辑:程序博客网 时间:2024/05/22 10:33
这两天学习git的时候,在本地创建了一个库,同时自己在GitHub上面也创建了一个库,照着廖老师的教程一步一步走到了push的环节突然出现了这样的错误:
[zhangxiyu@localhost learngit] $ git push -u origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
去百度,CSDN,GitHub等等各种地方去查只得到一个答案,说是pubickey没有绑定到远程GitHub上,但这个步骤之前分明已经都做过了,没办法只好把GitHub上的公钥删掉,同时在本地rm -r ~/.ssh
把.ssh文件夹全删掉重新生成ssh-keygen,重新把.ssh/id_rsa.pub绑定到GitHub。结果呢,还尼玛不行。还是提示上面的错误!woc!!!见了鬼了。然后就陷入了死循环,到处找解决方法,但结果是清一色的“没有绑定公钥”。
好在天无绝人之路,今天无意中看到了git push上传代码到gitlab上,报错401/403(或需要输入用户名和密码)这个帖子,突然想到了,昨天在push之前好像也遇到过这个问题:
[zhangxiyu@localhost learngit]$ git push -u github
error: The requested URL returned error: 403 Forbidden while accessing
https://github.com/zxy9527/zxy.git/info/refsfatal: HTTP request failed
然后在网上查找了一下问题不知怎么的就果断vi .git/config
,然后把
[remote “github”]
url = https://github.com/zxy9527/zxy.git
fetch = +refs/heads/:refs/remotes/github/
改成了
[remote “github”]
url = ssh://github.com/zxy9527/zxy.git
fetch = +refs/heads/:refs/remotes/github/
喜大普奔,403的问题没有了,但随之而来的就是无限的Permission denied (publickey)。。。就是上面说的问题。
- 解决办法
在代码的.git/config文件内[remote “origin”]的url的gitlab域名前添加gitlab注册时的“用户名:密码@”
例如我的GitHub用户名为zxy9527,密码为zxy123456(当然不是真的密码~),所以.git/config文件内就应该改为:
[remote “github”]
url = https://zxy9527:zxy123456@github.com/zxy9527/zxy.git
fetch = +refs/heads/:refs/remotes/github/
改完之后,确保你的公钥已经绑定到GitHub(这个网上有很详细的教程)之后,就可以愉快的push啦!!
- Permission denied (publickey). fatal: The remote end hung up unexpectedly 解决办法
- Permission denied (publickey). fatal: The remote end hung up unexpectedly while pushing back to git
- Permission denied (publickey,keyboard-interactive). fatal: The remote end hung up unexpectedly 解决方法
- Git(GitHub) 005 添加SSH密钥 — 解决:Permission denied (publickey) fatal The remote end hung up unexpectedly
- fatal: the remote end hung up unexpectedly
- fatal: the remote end hung up unexpectedly
- fatal: the remote end hung up unexpectedly
- fatal: the remote end hung up unexpectedly
- fatal: The remote end hung up unexpectedly
- fatal: The remote end hung up unexpectedly
- fatal: the remote end hung up unexpectedly
- fatal: The remote end hung up unexpectedly
- git push错误;fatal: The remote end hung up unexpectedly
- git push错误;fatal: The remote end hung up unexpectedly
- git fatal: the remote end hung up unexpectedly
- Git fatal: The remote end hung up unexpectedly
- Git: fatal: The remote end hung up unexpectedly 解决方法
- Git异常fatal:The remote end hung up unexpectedly
- HDU1257
- java 整合Web调用kettle本地转换
- JS数组与对象的遍历方法大全
- 计算机网络(1):运输层(TCP/UDP)
- 设计模式(17) 责任链模式(简单入门 行为模式)
- Permission denied (publickey). fatal: The remote end hung up unexpectedly 解决办法
- AngularJS实现跨域请求
- EvenBus No subscribers registered for event class 发送消息失败
- c++ sort函数的使用
- STM32怎么读取输出口电平
- chrome浏览器当鼠标碰到超链接的时候会窗口会抖动
- 国务院关于印发新一代人工智能发展规划的通知
- Hough transform(霍夫变换)
- 利用豆瓣短评数据生成词云