• 周二. 11 月 24th, 2026

Unable to negotiate with xxx.xxx.xxx.xxx port 22: no matching host key type found. Their offer: ssh-rsa

由root

4 月 18, 2022 #Git

今天在windwos10环境,升级git软件版本后, phpstorm就报错无法连接到gitlab服务器。 马上就怀疑是安装Git导致了ssh key失效。 然后重新生成ssh key, 添加到gitlab后台, 再次尝试失败, 并报以下错误信息

Unable to negotiate with xx.xx.xx.xx port 22: no matching key exchange method found.
Their offer:diffie-hellman-group1-sha1

解决办法:
在生成公钥的~/.ssh文件夹下,新建一个config文件(config文件没有后缀),文件中添加如下内容:
Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

然后保存即可。
注意:xx.xx.xx.xx为服务器ip;+前面有一个空格!

由 root