Unable to negotiate with 106.52.160.162 port 22: no matching host key type found. Their offer: ssh-rsa
时间: 2023-10-19 21:09:12 浏览: 52
出"Unable to negotiate with 106.52.160.162 port 22: no matching host key type found. Their offer: ssh-rsa"的错误提示是因为Git找不到支持的密钥交换方法。新版Openssh中不再支持SHA1这种hash散列算法,需要手动允许对于SHA1的支持。
解决办法是在生成公钥的.ssh文件夹中,新建一个没有后缀的config文件,并在其中添加以下内容:
Host *
HostkeyAlgorithms ssh-rsa
PubkeyAcceptedKeyTypes ssh-rsa
保存后,再次使用git命令应该就能恢复正常啦。
相关问题
Unable to negotiate with 10.128.0.0 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
"Unable to negotiate with 10.128.0.0 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss" 这个错误表示终端无法与目标主机建立SSH连接,因为没有找到匹配的主机密钥类型。在新版的OpenSSH中,默认不再支持使用SHA1这种较弱的散列算法。要解决这个问题,我们需要手动允许对于SHA1的支持。
为了解决这个问题,您可以尝试以下步骤:
1. 在终端中使用以下命令连接到目标主机:
ssh -oHostKeyAlgorithms=+ssh-rsa -oKexAlgorithms=+diffie-hellman-group1-sha1 user@10.128.0.0
这将允许使用ssh-rsa主机密钥类型和diffie-hellman-group1-sha1密钥交换方法进行连接。
2. 如果第一步无效,您可以尝试在SSH配置文件中进行更改。打开SSH配置文件(通常位于/etc/ssh/或~/.ssh/目录下的ssh_config文件),找到HostKeyAlgorithms和KexAlgorithms这两个选项,将它们的值分别改为:
HostKeyAlgorithms +ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1
3. 保存并关闭配置文件,然后尝试重新连接到目标主机。
通过以上步骤,您应该能够解决"Unable to negotiate with 10.128.0.0 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss"的问题。记得在连接之前备份配置文件,以便在需要时进行恢复。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Unable to negotiate with 172.16.28.137 port 22: no matching host key type found. Their offer: ssh-rs](https://blog.csdn.net/wuliuqi_567/article/details/128103215)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [Unable to negotiate with 192.168.2.53 port 22: no matching host key type found. Their offer: ssh-rsa](https://blog.csdn.net/weixin_43025071/article/details/128241732)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
Unable to negotiate with 10.64.35.158 port 22: no matching host key type found. Their offer: ssh-rsa
这个错误通常是由于SSH客户端和SSH服务器之间的密钥类型不匹配造成的。要解决这个问题,你可以尝试以下方法之一:
1. 更新SSH客户端版本:确保你使用的SSH客户端是最新版本,以支持更多的密钥类型。
2. 更新SSH服务器配置:在SSH服务器上,你可以尝试修改SSH配置文件(通常是/etc/ssh/sshd_config)来允许更多的密钥类型。你可以添加以下行到配置文件中:
```
HostKeyAlgorithms +ssh-rsa
```
保存并重新启动SSH服务器。
3. 指定密钥类型:在使用SSH客户端连接时,你可以尝试指定使用的密钥类型。例如,你可以使用以下命令连接到服务器:
```
ssh -oHostKeyAlgorithms=+ssh-rsa user@10.64.35.158
```
这样会告诉SSH客户端使用ssh-rsa密钥类型连接到服务器。
请注意,这些方法可能因为不同的操作系统或SSH版本而有所不同。如果上述方法仍然无法解决问题,你可能需要进一步检查网络设置和密钥配置。