ssh的git仓库在clone的时候遇到错误:

no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.

原因描述

原因是server端的 Host key 认证使用ssh-rsa算法,ssh-rsa使用的是RSA SHA-1,已经被认为是不安全的算法,所以较新版本的ssh客户端已经默认不允许ssh-rsa

解决方案

修改~/.ssh/config配置:

Host host
    User user
    PubkeyAcceptedAlgorithms +ssh-rsa
    HostkeyAlgorithms +ssh-rsa