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.
I am using windows, for my case git clone fails in Jenkins (running under system user).
Adding
into ~/.ssh/config will make the clone running as the current user works.
For other users, the OpenSSH won't pick up the config. I have to add the above config into the global config file: "C:\Program Files\Git\etc\ssh\ssh_config" to make it work.
attach my ssh config for people who come across the same issue
use larger postBuffer if come accross another issue
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
Your problem is described in details here:
Setting alternate ssh keys
now add the public key under your server account and try again.
Include above lines in .config file and add .config file in .ssh directory where id_rsa.pub and other files are located.
This error occurs when the client and server are unable to agree on the key exchange algorithm to use. You can see in the error log what key exchange algorithms the server is offering to use. In case when your client is unable to work with the methods offered by the server, the error is thrown. To fix this issue changes can be made on the client or server side. If you can change the server's configuration, that would be the better path to take as you wouldn't have to make changes in all clients. To fix the issue on the server side, you need to upgrade/configure the server to not use deprecated algorithms.
If change on the server side is not possible, one could simply force the client to re-enable the key exchange algorithms the server is ready to work with. You can do this permanelty by updating the ~/.ssh/config file on linux or C:\Program Files\Git\etc\ssh\ssh_config file on windows and adding the following lines :