git使用中遇到的问题汇总

no matching key exchange method found

在使用git clone克隆远程仓库时,有时候会遇到类似如下的报错信息:

Unable to negotiate with 10.1.30.232 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
fatal: Could not read from remote repository.

这是怎么回事呢?从字面上理解,git服务器端支持diffie-hellman-group1-sha1这种密钥交换方法,而git客户端不支持。

在页面OpenSSH Legacy Options中有如下解释:

If the client and server are unable to agree on a mutual set of parameters then the connection will fail. OpenSSH (7.0 and greater) will produce an error message like this:

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

In this case, the client and server were unable to agree on the key exchange algorithm. The server offered only a single method diffie-hellman-group1-sha1. OpenSSH supports this method, but does not enable it by default because is weak and within theoretical range of the so-called Logjam attack.

并且提供了解决办法:

The best resolution for these failures is to upgrade the software at the other end. OpenSSH only disables algorithms that we actively recommend against using because they are known to be weak. In some cases, this might not be immediately possible so you may need to temporarily re-enable the weak algorithms to retain access.

For the case of the above error message, OpenSSH can be configured to enable the diffie-hellman-group1-sha1 key exchange algorithm (or any other that is disabled by default) using the KexAlgorithms option - either on the command-line:

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@legacyhost

or in the ~/.ssh/config file:

Host somehost.example.org
 KexAlgorithms +diffie-hellman-group1-sha1

The '+' before the list instructs ssh to append the algorithm to the client's default set rather than replacing the default. By appending, you will automatically upgrade to the best supported algorithm when the server starts supporting it.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • OpenSSH7.0做出了一些变更,默认禁用了一些较低版本的密钥算法。 受此影响,在同一系统中的主机、网络设备必须...
    RiboseYim阅读 7,737评论 0 1
  • After I made some code modifications, I try to commit and...
    fuxiaotao阅读 4,202评论 0 0
  • 罢了,就任那感伤划过心房 待那躁动的心弦不在颤动 一切都平静了 再回首 灰色的回忆也会泛起光华 天依旧蓝,水依旧清...
    小青年不文艺阅读 2,118评论 0 1
  • 今冬,江南的雪犹如怀抱琵琶的女子,千呼万呼始出来。看见雪花纷飞,我顿时激动得像个孩子,奔进古巷,展袂,与雪花共舞…...
    系上了思念阅读 2,405评论 0 0
  • 一个高中辍学的穷小子,借由记事本的力量,彻底扭转人生的困境。从二十一岁在记事本写下梦想和圆梦计划起,15年后终于实...
    sunny视界阅读 5,366评论 0 16