使用"KexAlgorithms diffie-hellman-group1-sha1"没有解决"找不到匹配的密钥交换方法"错误

Tom*_*ica 7 windows git ssh

关于以下错误有很多问题,但它们都有相同的解决方案,没有任何影响:

$ 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.
Run Code Online (Sandbox Code Playgroud)

openssh.com上一篇文章没有帮助.特别建议:

...在〜/ .ssh/config文件中:

Host somehost.example.org
KexAlgorithms +diffie-hellman-group1-sha1
Run Code Online (Sandbox Code Playgroud)

我做到了那一点.我假设~解决了%userprofile%在Windows上.我的文件是C:\Users\MY_USERNAME\.ssh\config:

## use kex algorithm ##
Host 192.168.XXX.XXX
KexAlgorithms diffie-hellman-group1-sha1
Run Code Online (Sandbox Code Playgroud)

结果是没有任何改变.还有建议使用,ssh -o但我还没有找到一个难以描述你究竟是怎么做的答案.我试过这个:

$ ssh -oKexAlgorithms=+diffie-hellman-group1-sha1
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
Run Code Online (Sandbox Code Playgroud)

我需要连接到那个GIT存储库.我在窗户上.存储库使用Gerrit.我也使用SourceTree,它没有问题进入存储库.所以存储库工作,但我的bash中的git或openSSH被破坏了.

这个解决方案对我不起作用,我做错了什么?

Tom*_*ica 8

通过使用此命令解决我在一些评论线程中随机找到的:

export GIT_SSH_COMMAND='ssh -o KexAlgorithms=+diffie-hellman-group1-sha1'
Run Code Online (Sandbox Code Playgroud)

每次打开Git Bash时都必须调用.是的,git是地狱.