服务器例行维护时,升级了所有的软件。当再次使用 gitlab-runner 部署时,出现了 Host key verification failed 问题,本文简单说下解决思路!
问题
Running with gitlab-runner 14.6.0 (5316d4ac)
on iZ2ze3ifc44ezcec5t2nhrZ mzVoCiZK
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:01
Running on iZ2ze3ifc44ezcec5t2nhrZ...
Getting source from Git repository
00:00
Fetching changes with git depth set to 50...
Initialized empty Git repository in /home/gitlab-runner/builds/mzVoCiZK/0/penndu/dusays/.git/
Created fresh repository.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ERROR: Job failed: exit status 1
注意:上面是部署时报错。
解决
杜老师一开始以为是密钥的问题,曾尝试同步了客户端和服务端的密钥,但还是会报错,且报错的内容不变。
后来直接设置了 SSH 免密登录,问题仍然存在,但报错的内容变了。
提示是权限的问题,于是修改 gitlab-runner 的运行用户,成功搞定。
遇到同样问题的小伙伴,可以参考《修改 gitlab-runner 的执行用户》一文。
条评论