问题详情
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)?
原因:
- ssh 过期了
- 没设置 ssh, 或者设置没生效
解决方法:
- 先找到主机秘钥并删除(如果没有设置过可忽略这一步)
# 先到家目录
cd ~
# 级联删除旧的.ssh
rm -r .ssh
- 从重新建一个秘钥
# 新建一个 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