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

git clone报错:Permission denied (publickey). fatal: Could not read from remote repository...

时间:2022-12-12 06:25:48

相关推荐

git clone报错:Permission denied (publickey). fatal: Could not read from remote repository...

原文:git clone报错:Permission denied (publickey). fatal: Could not read from remote repository…

今天clone一份github代码,报错:

Permission denied (publickey).fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

查了资料发现是因为本机的publickey没有添加到github(因为刚刚重装了系统),之前一直以为访问公开库没有添加公钥的要求,这波才知道原来只要是clone github代码就需要添加公钥

秘钥生成

ssh-keygen -t rsa -C "youremail"

密码不用设置,直接回车即可。完成后在~/.ssh目录生成两个文件:id_rsaid_rsa.pub

添加秘钥

在github上添加ssh密钥,这要添加的是id_rsa.pub里面的公钥

在github官网,点击头像->Settings->SSH and GPG keys->New SSH key,添加公钥即可

添加公钥之后,就可以从github正常拉取代码了

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