zaki tutu
zaki tutu

Reputation: 685

How to solve the problem Host key verification failed

I created a .gitlab-ci.yml file. the project is already in the remote server. I created gitlab-runner in my remote server and I chose the shell option. my file .gitlab-ci.yml just makes the update for the project i.e. (we will do "git pull origin master" and here is my .gitlab-ci.yml script

stages:
   - build
before_script:
   - cd/home/devops/projects/my-project
building:
   stage: build
   script:
     - git status
     - sudo git pull origin master

when I run the pipeline i get this error.

$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. "

please how could we solve this problem? I'm really stuck with this problem

thank you so much

Upvotes: 3

Views: 30628

Answers (1)

vsergi
vsergi

Reputation: 785

It seems like an issue with your ssh keys between the gitlab-runner host and gitlab. This topic might answer your question:

Git-error-host-key-verification-failed-when-connecting-to-remote-repository

Basically, log in your gitlab-runner host and check ${HOME}/.ssh/known_hosts. You should see the current public key from your gitlab host. If not, you will need to remove it and update it.

Upvotes: 2

Related Questions