【问题标题】:SSH : Unable to negotiate with XXX.XXX.XX.XXX : no matching key exchange method found. They offer: diffie-hellman-group1-sha1 [closed]SSH:无法与 XXX.XXX.XX.XXX 协商:找不到匹配的密钥交换方法。他们提供:diffie-hellman-group1-sha1 [关闭]
【发布时间】:2016-05-12 22:57:28
【问题描述】:

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

$ 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.

*已经检查了文档http://www.openssh.com/legacy.html 和帖子http://www.openssh.com/legacy.html 中的解决方案,仍然得到错误。

已经添加到我的配置文件中 托管 somehost.example.org KexAlgorithms +diffie-hellman-group1-sha1

有什么帮助吗?

【问题讨论】:

  • 您可以尝试搜索您的错误消息。这似乎直接导致了 openssh.com 网站上的文档。
  • 我已经检查了文档并按照步骤操作,但仍然得到相同的错误。 @larsks
  • 然后更新您的问题以向您展示您尝试过的内容(具体的命令行),否则我们将继续告诉您同样的事情。
  • 检查我的编辑。 @larsks
  • 您的更新并未显示您正在使用来自openssh.com/legacy.html 的解决方案。

标签: git ssh


【解决方案1】:

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

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

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

【讨论】:

  • 有效!感谢您的回答!
  • git 的存储库特定配置文件没有获取使用 -o 给出的命令行参数。所以我不得不将这些参数(KexAlgorithms +diffie-hellman-group1-sha1)提供给 ~/.ssh/config 中的 ssh。然后它起作用了。我怀疑问题是当我将这些参数提供给存储库特定的 git 配置文件时,git 获取的 ssh 主机名是实际的 IP 地址,而当我将这些参数提供给 ssh 配置文件时,ssh 将其应用于主机名的 FQDN,它起作用了。这很奇怪。
猜你喜欢
  • 2016-12-10
  • 2012-03-14
  • 2012-09-07
  • 2022-08-03
  • 2021-12-20
  • 1970-01-01
  • 1970-01-01
  • 2016-05-15
相关资源
最近更新 更多