【发布时间】:2016-12-10 17:53:58
【问题描述】:
关于以下错误有很多问题,但他们都有相同的解决方案,但没有任何效果:
$ git push
Unable to negotiate with 192.168.XXX.XXX: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有一个 article on openssh.com 没有帮助。特别是有人建议:
...在 ~/.ssh/config 文件中:
Host somehost.example.org KexAlgorithms +diffie-hellman-group1-sha1
我就是这么做的。我假设 ~ 在 Windows 上解析为 %userprofile%。我的文件在C:\Users\MY_USERNAME\.ssh\config:
## use kex algorithm ##
Host 192.168.XXX.XXX
KexAlgorithms diffie-hellman-group1-sha1
结果是什么都没有改变。还有人建议使用ssh -o,但我还没有找到一个答案来描述你是如何做到这一点的。我试过这个:
$ ssh -oKexAlgorithms=+diffie-hellman-group1-sha1
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
我需要连接到那个 GIT 存储库。我在窗户上。存储库使用 Gerrit。我也使用 SourceTree,它推入存储库没有问题。所以存储库可以工作,但是我的 bash 中的 git 或 openSSH 坏了。
我做错了什么,这个解决方案对我不起作用?
【问题讨论】:
-
尝试使用“-vv”标志运行 ssh。它将打印它读取的配置文件的名称,并打印密钥交换的详细信息。
-
你说你在配置文件中做了同样的事情,但是你的配置文件没有显示你做了。你有
KexAlgorithms diffie-hellman-group1-sha1,但需要KexAlgorithms +diffie-hellman-group1-sha1。注意diffie之前的+。 -
@BrianPursley Hah,5 年后我终于知道我做错了什么以及为什么我的答案中的命令有效。