git拉取代码报错:
Unable to negotiate with 172.18.19.44 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
SSH有几种不同类型的密钥:RSA密钥 (ssh-rsa) 可以支持多种签名。签名类型sssh-rsa是指带有SHA-1的RSA,而签名类型rsa-sha2-256是带有SHA-256的RSA,rsa-sha2-512是带有SHA-512的RSA。
上面报错中提示,git服务端中使用的密钥是ssh-rsa类型的,而我本地的ssh(openSSH 9.x)默认不支持这种算法,需要指定下算法
解决方案:
进入~/.ssh目录,打开config文件(没有的话新建一个),添加如下配置:
Host {域名}
User git
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
{域名}替换成你自己的git服务器域名