系统升级后推送代码 git push 出现错误。

Unable to negotiate with 11.23.23.23 port 22: 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.

查看 ~/.ssh 目录下存在 id_rsa 和 id_rsa.pub 文件,系统未升级前是可以正常推送代码的。

解决办法

1 创建配置文件,如果已经存在则跳过此步骤

touch ~/.ssh/config

2 追加配置内容

cat >> ~/.ssh/config<<EOF
Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
EOF

标签: Git