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

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

设置git用户名/邮箱

git config --global user.name "xxx"

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

 

生成SSH**过程:

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

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

2.生存**:

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

执行命令之后如图所示:

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

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

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

添加完再次去clone就OK了

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

 

相关文章: