使用"KexAlgorithms diffie-hellman-group1-sha1"不能解决“找不到匹配的密钥交换方法".错误 [英] Using "KexAlgorithms diffie-hellman-group1-sha1" did not resolve "no matching key exchange method found" error

查看:1964
本文介绍了使用"KexAlgorithms diffie-hellman-group1-sha1"不能解决“找不到匹配的密钥交换方法".错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

There's a lot of questions about the following error, but they all have same solution which did not have any effect:

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

openssh.com上的文章并没有帮助.特别建议:

There is an article on openssh.com that didn't help. Particularly this was suggested:

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

... in the ~/.ssh/config file:

Host somehost.example.org
KexAlgorithms +diffie-hellman-group1-sha1

我确实做到了.我假设Windows上的~解析为%userprofile%.我的文件在C:\Users\MY_USERNAME\.ssh\config:

I did exactly that. I assume that ~ resolves to %userprofile% on windows. My file is in C:\Users\MY_USERNAME\.ssh\config:

## use kex algorithm ##
Host 192.168.XXX.XXX
KexAlgorithms diffie-hellman-group1-sha1

结果是什么都没有改变.也有建议使用ssh -o,但我还没有找到一个答案来描述您如何精确地做到这一点.我试过了:

The result is that nothing changed. There is also suggestion to use ssh -o but I'm yet to find an answer that bothers to describe how exactly yo do that. I tried this:

$ ssh -oKexAlgorithms=+diffie-hellman-group1-sha1
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]

我需要连接到该GIT存储库.我在窗户上.该存储库使用Gerrit.我也使用SourceTree,它推入存储库没有问题.因此存储库可以正常工作,但是我的bash中的git或openSSH损坏了.

I need to connect to that GIT repository. I am on windows. The repository uses Gerrit. I also use SourceTree and it has no problems pushing into the repository. So the repository works, but git or openSSH in my bash is broken.

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

What did I do wrong that this solution didn't work for me?

推荐答案

使用以下命令解决了我在一些注释线程中随机发现的问题:

Resolved by using this command I randomly found in some comment thread:

export GIT_SSH_COMMAND='ssh -o KexAlgorithms=+diffie-hellman-group1-sha1'

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

Must be called every time you open the Git Bash. Yeah, git is hell.

这篇关于使用"KexAlgorithms diffie-hellman-group1-sha1"不能解决“找不到匹配的密钥交换方法".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆