Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting jenkins git returns "Host key verification failed" error

I want to put one of my jenkins projects into source code management with git.

However, when I typed [email protected]:myGitlabAccount/myProjectName.git into Repository URL under Source Code Management tab in the project configuration page. I saw the following error message:

Failed to connect to repository : Command "git.exe ls-remote -h [email protected]:myGitlabAccount/myProjectName.git" returned status code 128:
stdout: 
stderr: Host key verification failed. 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

There's no error message when I type git.exe ls-remote -h [email protected]:myGitlabAccount/myProjectName.git under windows command line.

I can git clone [email protected]:myGitlabAccount/myProjectName.git successfully.

And I think that Jenkins Host key verification failed is a solution to my problem if I were a linux jenkins user.

But I use jenkins under windows environment, and I don't find any user called jenkins in windows.

How can I switch to jenkins user and type git ls-remote -h [email protected]:person/projectmarket.git HEAD manually in windows environment?

like image 235
Brian Avatar asked Dec 01 '22 15:12

Brian


1 Answers

If you installed Jenkins per default as a Windows service, you can copy a file named "known_hosts" under the directory

C:\Windows\System32\Config\SystemProfile\ .ssh

This will be read by Jenkins then and allow it to access your Git server.

like image 182
Harry Blauberg Avatar answered Dec 04 '22 00:12

Harry Blauberg