#执行如下语句(已经在服务器上添加了公钥)
git clone ssh://username@test.com:sourcegit/sourcegit.git
#报错
username@test.com: Permission denied (publickey).
#使用如下命令查看详细报错信息
ssh -Tv test.com
#可以看到如下信息
debug1: send_pubkey_test: no mutual signature algorithm
debug1: No more authentication methods to try.
出错原因:
由于OpenSSH从8.8版本由于安全原因开始弃用了rsa加密的密钥
解决方法:
修改 /etc/ssh/ssh_config 增加如下配置
PubkeyAcceptedKeyTypes +ssh-rsa