问题描述
我已经进行了大量搜索并测试了不同的解决方案,但没有成功!
当我想推送我的代码时,我收到以下错误:
Warning: the ECDSA host key for 'git.mywebsite.ir' differs from the key for the IP address '164.138.23.11'
Offending key for IP in /home/alireza/.ssh/known_hosts:10
Matching host key in /home/alireza/.ssh/known_hosts:1
Are you sure you want to continue connecting (yes/no)? yes
每次推送更改时,我应该怎么做才能删除此消息?任何的想法?
最佳答案
它说:
Offending key for IP in /home/alireza/.ssh/known_hosts:10
因此,出于某种原因,您必须删除 known_hosts 中的第 10 行。
运行以下命令删除 known_hosts 中的第 10 行:
sed -i '10d' ~/.ssh/known_hosts
或使用 ssh-keygen
ssh-keygen -R git.mywebsite.ir
来自男人的报价
-R hostname Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).