[Git FAQs] Git clone with SSH HostkeyAlgorithms and PubkeyAcceptedKeyTypes options
no matching host key type found. Their offer: ssh-rsa,ssh-dss
You may see an error no matching host key type found. Their offer: ssh-rsa,ssh-dss
when us git clone a remote project / repository with SSH.
1 | git clone ssh://git@<Your Git Host>:<Your Git Port>/<Your Group>/<Your Project>.git |
OpenSSH 7.0 and greater similarly disable the ssh-dss (DSA) public key algorithm. It too is weak and we recommend against its use.
“OpenSSH Legacy Options”:http://www.openssh.com/legacy.html
Solution
~/.ssh/config
Create or edit ~/.ssh/config
file append HostKeyAlgorithms +ssh-rsa
and PubkeyAcceptedKeyTypes +ssh-rsa
.
1 | .ssh/config |
Repository level configuration
Set SSH Options into .git/config
file
1 | git config core.sshCommand 'ssh -o HostKeyAlgorithms +ssh-rss -o PubkeyAcceptedKeyTypes +ssh-rsa' |
Command Options
The Released git 2.3 supports a new variable GIT_SSH_COMMAND
which can be used to define a command WITH parameters.
1 | GIT_SSH_COMMAND="ssh -o HostKeyAlgorithms +ssh-rss -o PubkeyAcceptedKeyTypes +ssh-rsa" git clone ssh://git@<Your Git Host>:<Your Git Port>/<Your Group>/<Your Project>.git |
References
[1] OpenSSH: Legacy Options - http://www.openssh.com/legacy.html