23 / 12 / 25
问题现象:
root@DESKTOP MINGW64 /f/git $ git clone "ssh://[email protected]:/test-repo" Cloning into 'test-repo'... Unable to negotiate with gerrit.abc.com port 12345: no matching host key type found. Their offer: ssh-rsa fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
问题原因:OpenSSH觉得ssh-rsa加密不安全,默认禁止了ssh-rsa方式连接
问题解决:
修改C:\\Program Files\Git\etc\ssh\ssh_config
添加:
Host * KexAlgorithms +diffie-hellman-group1-sha1 HostkeyAlgorithms +ssh-dss,ssh-rsa PubkeyAcceptedKeyTypes +ssh-dss,ssh-rsa
保存后生效,可正常git clone