关于gitlab:通过拉取-gitlab代码报错的解决方案

10次阅读

共计 1718 个字符,预计需要花费 5 分钟才能阅读完成。

错误信息如下

xxx@MacBook-Pro xxx-code % git cl       git@gitlab.xxxxxx-inc.com:xxx_fe_organization/xxx-erp-data.git
Cloning into 'xxx-erp-data'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for gitlab.xxxxxx-inc.com has changed,
and the key for the corresponding IP address 8.xxx.xxx.xxx
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:XX4mhCdJN2p5x4naUlqf8sVAW5i7ffekWFu83QM3bN0.
Please contact your system administrator.
Add correct host key in /Users/xx/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/xx/.ssh/known_hosts:7
ECDSA host key for gitlab.xxxxxx-inc.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.
xxx@MacBook-Pro xxx-code % 

重现步骤:

  1. 登陆公司的 VPN (代码在公司内网)
  2. 从新生成 sshkey: 执行命令 ssh-keygen
  3. gitlab 上增加新的 sshkey: 执行 open ~/.ssh/id_rsa.pub 获取
  4. git cl xxxx 拉代码 // 报错了

依据报错信息尝试的解决办法:

一、WARNING: POSSIBLE DNS SPOOFING DETECTED!

dns 应用的 google 8.8.8.8, 8.8.4.4,排除 DNS 问题

二、The ECDSA host key for gitlab.xxxxxx-inc.com has changed,

依据错误信息找到 https://www.jianshu.com/p/04a… 材料。
执行步骤

  • 清空.ssh 内容 // 这一步是要害
  • 执行: ssh-keygen 从新生成 sshKey, 再增加到 gitlab 中
  • 通过 git cl git@gitlab.xxxxx-inc.com:xxxx_organization/xxxx-data.git 拉取代码胜利
正文完
 0