这两天学习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/refs

fatal: 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用户名为blx9527,密码为blx123456(当然不是真的密码~),所以.git/config文件内就应该改为:

[remote “github”] 
url = https://blx9527:blx123456@github.com/zxy9527/zxy.git 
fetch = +refs/heads/:refs/remotes/github/

改完之后,确保你的公钥已经绑定到GitHub(这个网上有很详细的教程)之后,就可以愉快的push啦!!

Permission denied (publickey). fatal: The remote end hung up unexpectedly 解决办法的更多相关文章

  1. fatal: The remote end hung up unexpectedly解决办法

    $ git config --global http.postBuffer 2428000 git config http.postBuffer 524288000 配置完成后 git pull一下, ...

  2. ssh: Could not resolve hostname git.*****-inc.com : Temporary failure in name resolution fatal: The remote end hung up unexpectedly

    问题出现的情景:使用git pull拉取开发的代码到测试服务器,报错: ssh: Could not resolve hostname git.****-inc.com : Temporary fai ...

  3. github Permission denied (publickey). fatal: Could not read from remote repository.

    github Permission denied (publickey).fatal: Could not read from remote repository. ----------------- ...

  4. git克隆出错 github clone Permission denied (publickey) fatal Could not read from remote repo

    原文网址:http://blog.csdn.net/feeling450/article/details/53067563 github clone "Permission denied ( ...

  5. github下载报错:Permission denied (publickey). fatal: Could not read from remote repository.

    Permission denied (publickey). fatal: Could not read from remote repository. 博主在github上下载tiny face的的 ...

  6. 【git基础】Permission denied (publickey). fatal: Could not read from remote repository

    运行以下git命令的时候出现错误 git push -u origin master error The authenticity of host 'github.com (13.250.177.22 ...

  7. git提交报异常,fatal: The remote end hung up unexpectedly

    转自:http://liucanwen.iteye.com/blog/2021601 早上提交代码到 oschina代码库时,报了这个错误: fatal: The remote end hung up ...

  8. Git 提交大文件提示 fatal: The remote end hung up unexpectedly

    使用gitlab搭建的git server,如果直接使用http的方式去提交的话,提交小文件不会有问题,但是提交大文件时,会出错: fatal: The remote end hung up unex ...

  9. fatal: The remote end hung up unexpectedly

    git push 的时候出错,提示: fatal: The remote end hung up unexpectedly 遇见几次了,原因是因为文件太大,把限制放宽就好了.命令: git confi ...

随机推荐

  1. jQuery仿天猫完美加入购物车

    转载自:http://www.iteye.com/topic/1138064 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transiti ...

  2. LoadRunner内部结构

    转载自:http://blog.sina.com.cn/s/blog_6da75b980100n2nv.html   英文版地址: http://www.rickyzhu.com/21_princip ...

  3. vim设置配色主题

    默认主题注释为蓝色,完全看不清.可以在~/.vimrc当中设置colorscheme参数.我在zsh设置中设置了快捷键,直接编辑. colorscheme参数的值可以在 /usr/share/vim/ ...

  4. [CXF REST标准实战系列] 一、JAXB xml与javaBean的转换(转)

    转自:[CXF REST标准实战系列] 一.JAXB xml与javaBean的转换 文章Points: 1.不认识到犯错,然后得到永久的教训. 2.认识JAXB 3.代码实战 1.不认识到犯错,然后 ...

  5. 如何在cmd命令行中查看、修改、删除与添加环境变量,语法格式例子:set path;echo %APPDATA%

    如何在cmd命令行中查看.修改.删除与添加环境变量 首先明确一点: 所有的在cmd命令行下对环境变量的修改只对当前窗口有效,不是永久性的修改.也就是说当关闭此cmd命令行窗口后,将不再起作用.永久性修 ...

  6. Launchy – 快速调出你的程序

    http://www.appinn.com/launchy/这个可是今天绝对的发现,超级好玩好用的程序,Launchy 可以使你快速的调用你电脑中的程序快捷方式,而且很智能,使用起来很智能,安装后用A ...

  7. bootstrap table 插件 搜索

    以前用过easyui datagrid 每次搜索的时候调用datagrid构造方法 重新获取数据, 发现bootstrap-table 插件不行,只需要初始化一次, 以后每次搜索时,直接调用refre ...

  8. OAF_OAF控件系列5 - Train的实现(案例)

    2014-06-02 Created By BaoXinjian

  9. Android vcard使用示例,生成vcf文件

     Android vcard使用示例,生成vcf文件 我们备份手机联系人时,导出到SD卡时,会在SD卡中生成一个vcf文件,用于保存联系人姓名,手机号码. vCard 规范容许公开交换个人数据交换 ( ...

  10. Linux中断 - tasklet

    一.前言 对于中断处理而言,linux将其分成了两个部分,一个叫做中断handler(top half),属于不那么紧急需要处理的事情被推迟执行,我们称之deferable task,或者叫做bott ...