解决 `Warning: the RSA host key for 'github.com' differs from the key for the IP address 'x.x.x.x'`

Warning: the RSA host key for 'github.com' differs from the key for the IP address 'x.x.x.x'
Offending key for IP in /root/.ssh/known_hosts:5
Matching host key in /root/.ssh/known_hosts:9
Are you sure you want to continue connecting (yes/no)?

You can add the RSA host key for github.com to your server's known_hosts file to avoid seeing this warning every time you run git pull. Here's how to do it:

1.Open a terminal on your server and run the following command to remove the offending key for the IP address from the known_hosts file:

ssh-keygen -R x.x.x.x

2.Run the following command to add the RSA host key for github.com to the known_hosts file:

ssh-keyscan github.com >> ~/.ssh/known_hosts

This will append the RSA host key for github.com to the end of the known_hosts file in your home directory.

After running these commands, you should be able to run git pull without seeing the warning message again.

版权声明

本博客所有的原创文章,作者皆保留版权。转载必须包含本声明,保持本文完整,并以超链接形式注明作者后除和本文原始地址:https://blog.mazey.net/3284.html

(完)

发表评论

您的电子邮箱地址不会被公开。