Ubuntu下 git 报ssh key错误

先贴错误:


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for sh.gitlab.XXX.com has changed,
and the key for the corresponding IP address 192.168.44.118
is unknown. 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.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ECDSA key sent by the remote host is
SHA256:o1zEE5aNu0bCOdZ5//Qgzr0/gcDT2yA7Ko2xR5BnedA.
Please contact your system administrator.
Add correct host key in /home/XXX/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/XXX/.ssh/known_hosts:5
remove with:
ssh-keygen -f "/home/XXX/.ssh/known_hosts" -R "sh.gitlab.XXX.com"
ECDSA host key for sh.gitlab.XXX.com has changed and you have requested strict checking.
Host key verification failed.
fatal: 无法读取远程仓库。

请确认您有正确的访问权限并且仓库存在。

删了~/.ssh/known_hosts 变成需要输入gitlab密码。。我谢谢嗷

然后手动把域名添加到


ssh-keyscan -t rsa sh.gitlab.sihuatech.com >> ~/.ssh/known_hosts

解决

posted @ 2023-05-29 12:11  fengyujia  阅读(53)  评论(0编辑  收藏  举报