Jenkins: Failed to connect to repository

后端 未结 13 1615
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 04:16

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

相关标签:
13条回答
  • 2020-12-03 04:47

    In my case, I edited the known_hosts file with root user. So it changed the file ownership to root and jenkins user started throwing "git@github.com:xxxxxx/xxxx.git HEAD" returned status code 128: stdout: stderr: Host key verification failed" error while cloning git image. Reverting the ownership resolved the issue.

    0 讨论(0)
  • 2020-12-03 04:51

    On Ubuntu, placed your id_rsa and id_rsa.pub files in /var/lib/jenkins/.ssh

    Make Jenkins own them sudo chown -R jenkins /var/lib/jenkins/.ssh/

    Make sure that Jenkins key is added as deploy key with RW access in GitHub (or similar) - use the id_rsa.pub key for this.

    Now everything should jive with the SCM Sync Plugin.

    0 讨论(0)
  • 2020-12-03 04:53

    In our case git had to be installed on the Jenkins server.

    0 讨论(0)
  • 2020-12-03 04:54

    Let me add here that one very minor issue that could generate this type of error is the missing .git extension in the repository URL. Ensure you enter the fully qualified URL ending with .git. I use bitbucket so what I do do is do click 'clone' and the fully qualified URL is automatically generated for me. There is a similar approach with github.

    0 讨论(0)
  • 2020-12-03 04:57

    Not mentionned here so far, but this can come also from stash. We encountered the same issue, the root cause for our problem was that the stash instance we use for jenkins did crash. Restarting stash solved it in our case.

    0 讨论(0)
  • 2020-12-03 04:59

    Jenkins runs as another user, not as your ordinary login. So, do as this to solve the ssh problem:

    1. Log on as jenkins su jenkins (you may first have to do sudo passwd jenkins to be able to set the password for jenkins. I couldn't find the default...)
    2. Generate ssh key pair: ssh-keygen
    3. Copy the public key (id_rsa.pub) to your github account (or wherever)
    4. Clone the repo as jenkins in order to have the host added to jenkins known_hosts which is neccessary to do. Now you can remove the cloned repo again if you wish.
    0 讨论(0)
提交回复
热议问题