Git安装问题"no matching key exchange method found"

在本地ssh-keygen之后,把C:\User.ssh\目录下的id_rsa.pub中的秘钥复制到服务器配置中

1、遇到问题

Cloning into 'PROJECT'...
Unable to negotiate with 10.x.x.xxx port 8888: no matching key exchange method f
ound. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
fatal: Could not read from remote repository.

这是git的ssh支持算法没配置,那么先在C:\User\.ssh\下新建文件config,写进如下代码:

Host *

KexAlgorithms +diffie-hellman-group1-sha1

2、结果又报错

Cloning into 'PROJECT'...
Unable to negotiate with 10.x.x.xxx port 8888: no matching host key type found.
Their offer: ssh-rsa
fatal: Could not read from remote repository.

在刚才的文件中继续修改至如下内容:

Host *

KexAlgorithms +diffie-hellman-group1-sha1
HostkeyAlgorithms +ssh-dss,ssh-rsa
PubkeyAcceptedKeyTypes +ssh-dss,ssh-rsa

或者如果你之前已经有了config,可以在原来的内容后继续添加

Host 10.4.0.169
  KexAlgorithms +diffie-hellman-group1-sha1
  HostkeyAlgorithms +ssh-dss,ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-dss,ssh-rsa
posted @ 2022-11-25 16:51  月的光景  阅读(1588)  评论(0)    收藏  举报