关于以下错误有很多问题,但它们都有相同的解决方案,但没有任何影响:
$ 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被破坏了。
我的错误是这个解决方案对我不起作用?
答案 0 :(得分:8)
使用此命令解决了我在一些评论帖中随机找到的内容:
export GIT_SSH_COMMAND='ssh -o KexAlgorithms=+diffie-hellman-group1-sha1'
每次打开Git Bash时都必须调用。是的,git是地狱。
答案 1 :(得分:0)
我在Windows 10上解决了类似的问题,将我的Open SSH版本更新到最新版本(7.5p1-1),然后确保C:Program Files \ OpenSSH \ bin是系统路径中的第一个条目,因此它使用ssh.exe而不是其他任何人。
答案 2 :(得分:0)
在更新到“ git for Windows”到版本2.25.1之后,我开始出现此错误 This algo was deprecated by GitHub in Feb. of 2018.
@Kenster对“使用ssh -vv ...”的评论是关键。 Windows中的主驱动器是网络驱动器,因此默认的.ssh文件夹位于该网络卷上。
使用以下方法将名为“ config”的文件添加到该文件夹:
Host 127.0.0.1
Port 2222
KexAlgorithms +diffie-hellman-group1-sha1
允许我再次连接到我无所事事的环境。
答案 3 :(得分:0)
我也遇到了同样的问题。请安装旧版本的“ Git for Windows”。 https://github.com/git-for-windows/git/releases/tag/v2.17.1.windows.1 此版本将解决您的问题。
答案 4 :(得分:0)
在Windows 2.27.0上使用Git遇到相同的问题。
Windows的Git带来了自己的OpenSSH实现。我不得不更改配置文件C:\ Program Files \ Git \ etc \ ssh_config
Host myhost@example.com
Port 22
KexAlgorithms +diffie-hellman-group1-sha1
KexAlgorithms +diffie-hellman-group14-sha1