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

Posted 追逐时光者

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa(相关的知识,希望对你有一定的参考价值。

异常问题:

  下班之前升级了一下Git的版本,结果第二天过来拉取远程最新代码的时候就提示了下面的异常问题:

Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa
Git failed with a fatal error.
Git failed with a fatal error.
Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists. 

问题分析:

  通过翻译上面的报错信息大概说的是没有匹配到类型为ssh-rsa的主机秘钥。或者是可能你的代码仓库权限没有了。

于是我上代码托管平台看了下我的项目权限是否被修改了,结果发现没有变更(这个可能性别排除了)。然后既然是ssh-rsa秘钥的问题,我就是试着把本机的ssh-key重生生成了一次再去托管平台添加,然后依旧还是包这个错。

解决方案一,切换成HTTPS的方式

1、修改本地代码关联的远程地址

git remote set-url origin https://gitee.com/ysgdaydayup/pingrixuexilianxi.git

2、重新拉取成功 

git pulll

解决方案二、在.ssh文件中创建config文件并添加配置 

添加如下匹配:

第一行说明对所有主机生效,当然你也可以指定对应主机地址;

Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

Reference

https://www.cnblogs.com/daibeisi/p/15662546.html

以上是关于Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa(的主要内容,如果未能解决你的问题,请参考以下文章

记录Git Unable to negotiate with xxx... 问题

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

SSH_Unable to negotiate with 192.168.1.152 port 22: nomatching host host key type found. Their offer

Unable to negotiate with xxxxport 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

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

fiddler 502 System.Security.SecurityException Failed to negotiate HTTPS connection with server.fid