
git clone之报错git@gitee.com: Permission denied (publickey).fatal: Could not read from remote repositor
在载资源的时候,出现下面的错误因为没有正确设置公私钥,导致没有权限操作。
·
git clone之报错git@gitee.com: Permission denied (publickey).fatal: Could not read from remote repository.Please make sure you have the correct access rights and the repository exists.
在载资源的时候,出现下面的错误
因为没有正确设置公私钥,导致没有权限操作。
解决办法
1、先查看一下自己有没有生成过public key
cat ~/.ssh/id_rsa.pub
如果有的话是以ssh-rsa
开头,以账号的注册邮箱结尾的
我这里是有的,但是为什么报错呢,因为是不同的邮箱,也就是两个账号,这里可以自己找找之前的文件,打开看看是否是当前账号所绑定的邮箱
这里没有当前用的账号的邮箱的public key
,所以得重新生成
2、生成公私钥
ssh-keygen -t rsa -C “xxxxx@xxxxx.com”
这里的xxxxx@xxxxx.com是你自己的账号邮箱
然后使用记事本打开.puh
文件,Ctrl+A
全选,Ctrl+C
复制所有的内容
3、将public key
添加到码云
打开自己的Gitee
的设置–>ssh
公钥
https://gitee.com/profile/sshkeys
将上一步复制的内容完整的粘贴入框中,并自己起个名字
4、可以自己验证一下是否成功
ssh -T git@gitee.com
5、然后就可以继续clone
了
就成功了
更多推荐
所有评论(0)