我创建了一个 .gitlab-ci.yml 文件。 该项目已经在远程服务器中。 我在我的远程服务器上创建了 gitlab-runner 并选择了 shell 选项。 我的文件 .gitlab-ci.yml 只是对项目进行更新,即(我们将执行“git pull origin master” 这是我的 .gitlab-ci.yml 脚本
stages:
- build
before_script:
- cd/home/devops/projects/my-project
building:
stage: build
script:
- git status
- sudo git pull origin master
当我运行管道时出现此错误。
$git pull origin master.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists. "
请问我们如何解决这个问题? 我真的被这个问题困住了
非常感谢
最佳答案
gitlab-runner 主机和 gitlab 之间的 ssh key 似乎有问题。本主题可能会回答您的问题:
Git-error-host-key-verification-failed-when-connecting-to-remote-repository
基本上,登录您的 gitlab-runner 主机并检查 ${HOME}/.ssh/known_hosts
。你应该从你的 gitlab 主机上看到当前的公钥。如果没有,您需要将其删除并更新。
关于gitlab - 如何解决主机 key 验证失败的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64872577/