jozxyqk jozxyqk - 4 months ago 128
Git Question

ssh - Bad configuration option: KeyAlgorithms

I've started a gerrit server. When I try to ssh to it I get:

Unable to negotiate with 127.0.0.1 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1


As this is deprecated it needs to be manually enabled (http://www.openssh.com/legacy.html):

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 username@localhost -p 29418


This works fine. Now I want to
git clone
, but need to pass the
KexAlgorithms
option to ssh via git. One solution is to add the option to
~/.ssh/config
. This is what I added:

Host localhost
KeyAlgorithms +diffie-hellman-group1-sha1


The problem is I get the following error:

/home/username/.ssh/config: line 6: Bad configuration option: keyalgorithms


There's a
HostKeyAlgorithms
option that works there but that complains
Bad key types '+diffie-hellman-group1-sha1'
. How should I configure
git
/
ssh
to connect to gerrit?

Answer

You put there different option in the configuration, than on the command line. It should be

Host localhost
    KexAlgorithms +diffie-hellman-group1-sha1

KexAlgorithms are not the HostKeyAlgorithms. They are completely different options with different values serving for different purposes.