问题解决 - The RSA host key for gitlab has changed
作者:互联网
问题
git pull 遇到如下问题
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for gitlab.xxx.com has changed,
and the key for the corresponding IP address 11.11.111.111
has a different value. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /c/Users/xxx/.ssh/known_hosts:2
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:8vm2iWaWLwxxxxxxxxxxxxxxxxxxxxxxxxxxYJF6jvpo.
Please contact your system administrator.
Add correct host key in /c/Users/xxx/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/xxx/.ssh/known_hosts:3
RSA host key for gitlab.xxx.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
原因
本地计算机 known_hosts 中记录的 git 服务器的公钥和实际返回的公钥不匹配。
解决
1
最快的方法:更新一下 C:\Users\xxx\.ssh\known_hosts
中的记录
- 打开 known_hosts 文件,找到 gitlab.xxx.com 对应的记录,删掉
- 然后运行 git pull ,会提示你要不要将新的服务器地址加到 known_hosts 中,如果不像每次都提示一遍的话就加一下
2
当然,最保险的话,是重新生成一遍 ssh key pair,然后把服务器上的公钥也更新下
参考 -> https://www.jianshu.com/p/04a05cf6ff9f
标签:gitlab,changed,RSA,host,hosts,ssh,key,known,xxx 来源: https://www.cnblogs.com/maxstack/p/15985185.html