码云代码拉取失败Clone failed git@gitee.com: Permission denied (publickey).
最近入职一家新公司,拉取代码的时候报错,很尴尬,代码拉取都不行,Git的配置又是好好的,一时间不知道啥错误导致的,领导问项目看了没有…捉急。。
折腾了半天,哎。。小问题。
来看下错误吧:
看下仓库地址,有两种协议的 https 和 SSH 两种
我用https协议地址的时候报错如下:
error: unable to read askpass response from '/Users/xxx/Library/Caches/Google/AndroidStudio2021.1/tmp/intellij-git-askpass-local.sh' fatal: could not read Username for 'https://gitee.com': Device not configured
用SSH协议的地址时候报错:
Clone failed
git@gitee.com: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
最后排查问题是因为码云账号的SSH公钥没有设置导致的拉取失败
如图所示
如果你的账号没有设置,请点击怎样生成公钥,按照上述提示进行配置。
怎样生成公钥
因为之前没怎么用码云,不知道这个细节,-- 配置之后https 协议的地址也可以用了。