git 中github clone "Permission denied (publickey). fatal: Could not read from remote repository."

版权声明:版权归qq175023117所有 https://blog.csdn.net/qq175023117/article/details/82881877

更换完电脑以后我想拉取我git上的库,出现报错如下图所示:

设置git用户名/邮箱

git config --global user.name "xxx"

git config --global user.email "[email protected]"

生成SSH密钥过程:

1.查看是否已经有了ssh密钥:cd ~/.ssh

如果没有密钥则不会有此文件夹,有则备份删除

2.生存密钥:

$ ssh-keygen -t rsa -C “[email protected]

扫描二维码关注公众号,回复: 4036108 查看本文章

执行命令之后如图所示:

最后得到了两个文件:id_rsa和id_rsa.pub 
添加密钥到ssh:ssh-add 文件名,需要之前输入密码.

在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。 
打开https://github.com/,在设置中添加密钥

添加完再次去clone就OK了

猜你喜欢

转载自blog.csdn.net/qq175023117/article/details/82881877
今日推荐