背景
最近使用本机很久未使用的 git 提交代码,每次提交都会出现 Warning: the ECDSA host key for 'github.com' differs from the key for the IP address
输入 yes 才能成功提交或者拉取代码,查找原因由于 github 更新 RSA key 导致,相关文章可以查看:github update RSA
解决方式
1、执行:ssh-keygen -R github.com
2、执行:for ip in $(for i in $(seq -f "140.82.%g.%%g" 112 127); do seq -f $i 1 254; done); do ssh-keygen -R $ip; done
or curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts