1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > git@github.com:Permission denied(publickey).fatal: Could not read form remote repository错误

git@github.com:Permission denied(publickey).fatal: Could not read form remote repository错误

时间:2021-06-04 05:52:36

相关推荐

git@github.com:Permission denied(publickey).fatal: Could not read form remote repository错误

文章目录

前言问题分析解决方法配置客户端配置服务端验证

前言

在使用goland从github下载依赖时(git clone /gin-gonic/gin)出现git@:Permission denied(publickey).fatal: Could not read form remote repository错误。

问题分析

Permission denied(publickey):没有权限

说明github和本地git没有生成ssh key或者ssh key不匹配

解决方法

配置客户端

客户端(本文为windows10电脑),打开git bash,执行ssh-keygen -t rsa -C "github登录邮箱"

然后一路回车(不用输入)。在git bash执行ssh -v git@

出现下方文字

No more authentication methods to try.Permission denied(publickey)

如图:在git bash执行ssh-agent -s,如图

在git bash执行ssh-add ~/.ssh/id_rsa,如图

出现Could not open a connection to your authentication agent警告

在git bash执行ssh-agent bash命令,然后再次执行ssh-add ~/.ssh/id_rsa

Identity added: /c/Users/zhandongyang/.ssh/id_rsa,这是ssh key文件在windows电脑上的位置,用记事本打开这个路径上的id_rsa.pub文件,复制里面的内容。

配置服务端

本文的服务端为github,访问github网站、登录,点击右上角的头像,然后点击Settings选择SSH and GPG keys,选择New SSH key

Title写个自己记得住的名字,Key填写复制的id_rsa.pub文件内容

验证

在客户端(本文为windows10电脑)的git bash执行ssh -T git@

至此结束。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。