ssh 连接报错:Unable to negotiate with 192.168.xx.xx port 22: no matching key exchange method found. 日期:2023-10-27 栏目:计算机分类:1 人气:1422 系统重装之后,重新生成ssh密钥,git拉取内网代码,报错如下: ``` Unable to negotiate with 192.168.1.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` 报错是因为OpenSSH 7.0以后的版本不再支持ssh-dss (DSA)算法 解决办法,在`.ssh/config`文件中添加如下配置: ``` Host 192.168.1.2 KexAlgorithms +diffie-hellman-group1-sha1 ``` 重新拉取代码,报错如下: ``` Unable to negotiate with 192.168.1.2 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` 原因是主机密钥类型不符合 解决办法,在`.ssh/config`文件中上面添加的内容下继续添加如下配置: ``` HostKeyAlgorithms +ssh-dss ``` 标签: git ssh 上一篇:如何使用mvn命令导入依赖 下一篇:thinkphp8.0 composer 更新报错 随便看看 2024-02-19 PHP7 运算符“??” 和“?:”的区别 2022-11-30 Linux 后台运行命令 2022-11-25 关于我们 2022-11-30 centos一键系统安装lnmp集成环境 2022-11-30 linux 生成 ssh 公钥 留言