GitHub提交报错Permission denied (publickey).

  • A+
所属分类:排错

 
 

在折腾提交代码到GitHub上遇到如下错误,经过一翻查找,解决方法如下

Permission denied (publickey).

fatal: The remote end hung up unexpectedly

 
 

第一步首现在你要提交的服务器上生成一个密钥对


备份后删除现有的密钥,

$ cd ~/.ssh

$ copy id_rsa* bacnkup/

$ rm id_rsa*

 
 

②生成新的密钥对

ssh-keygen -t rsa -C "your_email@youremail.com"

 
 


查看公钥,复制文件内的相关的内容

cat id_rsa.pub

 
 

④登陆GitHUB选择用户的-Settings

 

 
 

⑤选择
SSH and GPG Keys,选择New SSH Key

 
 

⑥ Title 随便写 KEY 粘帖上面的内容,完成后点击Add SSH Key

 
 

 
 

 
 

在登陆测试发现就会正常提交

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

头像

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: