git克隆代码失败Cloning into 'demo'... Unable to negotiate with x.x.x.x: no matching host key type found...

git克隆代码失败Cloning into 'demo'... Unable to negotiate with x.x.x.x: no matching host key type found. Their offer: xxx
编辑ssh配置,.ssh/config,如果config文件不存在,则新建一个,加入以下内容

Host *
KexAlgorithms +diffie-hellman-group1-sha1
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

原因如下:

失败问题1

Cloning into 'demo'...
Unable to negotiate with x.x.x.x: no matching host key type found. Their offer: diffie-hellman-group1-sha1
解决办法

KexAlgorithms +diffie-hellman-group1-sha1

失败问题2

Cloning into 'demo'...
Unable to negotiate with x.x.x.x: no matching host key type found. Their offer: ssh-rsa
解决办法

HostkeyAlgorithms +ssh-rsa

失败问题2

Cloning into 'demo'...
x.x.x.x: Permission denied (publickey)
解决办法

HostkeyAlgorithms +ssh-rsa

你可能感兴趣的:(git克隆代码失败Cloning into 'demo'... Unable to negotiate with x.x.x.x: no matching host key type found...)