1
votes

I'm a beginner to using jenkins and I'm having a problem with jenkins fetching from our repo.
I'm getting a "The remote end hung up unexpectedly" error.

08:26:19 Fetching upstream changes from [email protected]:myFork/myBranch.git

08:26:19 > git --version # timeout=10

08:26:19 using GIT_SSH to set credentials Jenkins user at gitlab

08:26:19 > git fetch --tags --progress [email protected]:myFork/myBranch.git +refs/heads/:refs/remotes/origin/

08:27:22 ERROR: Error cloning remote repo 'origin'

08:27:22 hudson.plugins.git.GitException: Command "git fetch --tags --progress [email protected]:myFork/myBranch.git +refs/heads/:refs/remotes/origin/" returned status code 128:

08:27:22 stdout:

08:27:22 stderr: ssh: connect to host my.gitrepo.net port 22: Connection timed out

08:27:22 fatal: The remote end hung up unexpectedly



I thought that maybe the remote is unreachable but I tried using

git ls-remote (our_repo.git)

in my local machine and it works so maybe it's not issue. (I guess?)

Is there configuration I need to consider to ensure the connection is correct?
Like maybe proper SSH. Currently we have set public SSH though.

1
You must try the same command (ls-remote) from the slave machine where jenkins is cloning the repoJayan
I checked it again today and the fetching finally works. Looks like some machine was just down for maintenance so that's our repo was not fetched.JuanLunaAtbp

1 Answers

1
votes

The fact that it works from your local machine simply means your public ssh key ($HOME/.ssh/id_rsa.pub or %USERPROFILE%\.ssh\id_rsa.pub) is registered in GitLab.

As mentioned in the GitLab-Jenkins integration page, you need to setup a deploy key, and make sure it is deployed on the Git repo you want to access (see the settings of your GitLab project)