ubuntu下git clone 出现Permission denied (publickey).

时间:2023-03-08 19:05:10

今天在ubuntu上使用git 克隆 github上面的库,一直权限拒绝Permission denied (publickey).

公钥绑了好几次,都不行;

最后怀疑是git配置公钥地址有问题:打开 /etc/ssh/ssh_config;

修改配置:IdentityFile ~/.ssh/id_rsa    ->  IdentityFile /home/llh/.ssh/id_rsa

成功!!!

怀疑原因:可能因为ubuntu使用sudo 权限时,用户发生变化使得~/.ssh/id_rsa 无法找到正确地址。

睡觉!!折腾好久!有空详细测试下到底什么问题。。。。。。