Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: Failed to connect to repository

I'm trying to connect jenkins on a github repo.

When I specify the Repo URL jenkins return the following error message:

Failed to connect to repository : Command "git ls-remote -h [email protected]:adolfosrs/jenkins-test.git HEAD" 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.

When using the HTTPS:// Url jenkins returns:

Failed to connect to repository : Failed to connect to https://github.com/adolfosrs/jenkins-test.git (status = 407)

I could successfully clone the repo at the same machine where jenkins is running and I also run the git ls-remote -h [email protected]:adolfosrs/jenkins-test.git HEAD command. So I have the right SSH at github.

like image 982
adolfosrs Avatar asked Feb 04 '14 16:02

adolfosrs


People also ask

How do I fix Jenkins failed to connect to repository?

You might need to set the path to your git executable in Manage Jenkins -> Configure System -> Git -> Git Installations -> Path to Git executable.


1 Answers

The problem was that somehow I created the ssh files with the root user. So the files owner was root.

The solution was just change the ownership to the jenkins user.

chown jenkins id_rsa.pub  chown jenkins id_rsa 
like image 136
adolfosrs Avatar answered Oct 05 '22 23:10

adolfosrs