jozxyqk jozxyqk - 1 year ago 316
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 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

As this is deprecated it needs to be manually enabled (

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

This works fine. Now I want to
git clone
, but need to pass the
option to ssh via git. One solution is to add the option to
. 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
option that works there but that complains
Bad key types '+diffie-hellman-group1-sha1'
. How should I configure
to connect to gerrit?

Answer Source

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.