可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am trying to clone the git repository and i am getting error
Unable to negotiate with <server>: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1 fatal: Could not read from remote repository.
I edited ~/.ssh/config
and added
Host somehost.example.org KexAlgorithms +diffie-hellman-group1-sha1"
but still I am getting same error.
Other solution is to use the command ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@127.0.0.1 -p 2222
but I am getting connection refused with port no 22 as well.
I am using windows machine.
回答1:
Your problem is described in details here:
If the client and server are unable to agree on a mutual set of parameters then the connection will fail.
OpenSSH (7.0 and greater) will produce an error message like this:
Unable to negotiate with 127.0.0.1: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
Setting alternate ssh keys
ssh-keygen -t rsa -C <your comment>
now add the public key under your server account and try again.
回答2:
touch ~/.ssh/config
attach my ssh config for people who come across the same issue
## use kex algorithm ## Host 10.172.4.66 KexAlgorithms diffie-hellman-group1-sha1 ## Avoid Write failed : boken pipe issue ## ServerAliveInterval 120 TCPKeepAlive no
use larger postBuffer if come accross another issue
fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
$ git config --global http.postBuffer 10000000000000000000000000000000 $ git clone ssh://xxx xx Cloning into 'xx'... remote: Counting objects: 105491, done. remote: Compressing objects: 100% (32876/32876), done. Receiving objects: 100% (105491/105491), 1.74 GiB | 19.55 MiB/s, done. remote: Total 105491 (delta 67211), reused 104583 (delta 66603) Resolving deltas: 100% (67211/67211), done. Checking connectivity... done. Checking out files: 100% (16545/16545), done.
回答3:
Host xxxx.yyyy.com KexAlgorithms +diffie-hellman-group1-sha1 Port portNumber User userName-yourDomain-com
Include above lines in .config file and add .config file in .ssh directory where id_rsa.pub and other files are located.
回答4:
If you are using windows and this error is happening in tortoise Git or Sourcetree try to generate your keys with puttYGen. Or create a new key from your existing private key with puttYGen (use the Load option) then save that private key with the extension ppk in a any folder. After that, add this key (with the extension ppk) in pageant (google to know how is the icon, it must appear in the right bottom corner next to hour) right click and add key. Try to be sure you setup your tortoise or your sourcetree to use this ppk key. Tortoise: Setting - Network - ssh client (must be TortoiseGitPLink.exe, if not is in the git tortoise git_home\bin folder) Source Tree: Tools - Options - SSh client Putty/PLink