Git error: warning: ecdsa host key for 'github.com' differs from key for ip address '20.205.243.166'

Question details

Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '20.205.243.166'
Offending key for IP in /Users/admin/.ssh/known_hosts:11
Matching host key in /Users/admin/.ssh/known_hosts:32
Are you sure you want to continue connecting (yes/no)?

reason:

  • ssh expired
  • ssh is not set, or the setting does not take effect

Solution:

  1. First find the host key and delete it (ignore this step if it has not been set)
# 先到家目录
cd  ~  
# 级联删除旧的.ssh
rm -r .ssh 
  1. Create a new key from
# 新建一个 ssh
mkdir -p ~/.ssh  
# 生成 ssh
ssh-keyscan -t rsa domain.com >> ~/.ssh/known_hosts
ssh-keygen -t rsa -C "你仓库绑定的邮箱"
# 回车直到生成成功
# 查看公钥并复制到 github 的 SSH Key
cat ~/.ssh/id_rsa.pub

Guess you like

Origin blog.csdn.net/qq_41536505/article/details/130271516