git SSH:无法与 XXX.XXX.XX.XXX 协商:找不到匹配的密钥交换方法。他们提供:diffie-hellman-group1-sha1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37187803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:00:18  来源:igfitidea点击:

SSH : Unable to negotiate with XXX.XXX.XX.XXX : no matching key exchange method found. They offer: diffie-hellman-group1-sha1

gitssh

提问by Rafael Reyes

I'm trying to clone a repo on Windows with MINGW64 and I get this error.

我正在尝试使用 MINGW64 在 Windows 上克隆一个存储库,但出现此错误。

$ git clone ssh://user@server/myproject && scp -p -P XXXXX user@server:hooks/commit-msg myproject/.git/hooks/
Cloning into 'myproject'...
Unable to negotiate with XXX.XXX.XX.XXX: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
fatal: Could not read from remote repository.

*Already check the doc http://www.openssh.com/legacy.htmland the Solution in the post http://www.openssh.com/legacy.htmland still get the error.

*已检查文档http://www.openssh.com/legacy.htmlhttp://www.openssh.com/legacy.html帖子中的解决方案,但仍然出现错误。

Already added this to my config file Host somehost.example.org KexAlgorithms +diffie-hellman-group1-sha1

已将此添加到我的配置文件 Host somehost.example.org KexAlgorithms +diffie-hellman-group1-sha1

Any Help?

任何帮助?

回答by

group1 is weak and should be disabled; see https://weakdh.org/sysadmin.html

group1 弱,应该被禁用;见https://weakdh.org/sysadmin.html

A server that onlysupports group1 is really bad. Asking the server operator to upgrade it is the right fix.

支持 group1 的服务器真的很糟糕。要求服务器运营商升级它是正确的解决办法。

If you're desperate to connect to it anyway, you should be able to tell your client to enable it with the ssh option KexAlgorithms +diffie-hellman-group1-sha1. It can be set in the ssh config file or on the command line with -o. If you want to use the command line option you'll need to tell git to pass the option to ssh, which is explained in the answers to this question: Passing ssh options to git clone

如果您无论如何都迫切希望连接到它,您应该能够告诉您的客户端使用 ssh 选项启用它KexAlgorithms +diffie-hellman-group1-sha1。它可以在 ssh 配置文件中设置,也可以在命令行中使用-o. 如果你想使用命令行选项,你需要告诉 git 将选项传递给 ssh,这在这个问题的答案中有解释:Passing ssh options to git clone