Departamento B Departamento B - 1 year ago 254
Git Question

git fetch --tags --progress times out in Jenkins, works fine on command line

I've configured Jenkins to poll a Git repository, I'm using https not ssh. The following URL is configured, and I use a username and password.

When I run the build, it stalls for 10 minutes and times out. When I copy the line where it times out and paste it to command line on the same machine as Jenkins runs (a macOS server), it works:

git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*

Why is it stuck for 10 minutes? I tried to use wrong credentials and that'll fail in a second. It's not a huge repo.

The log:

Started by user Jenkins Admin
Building in workspace /Users/Shared/Jenkins/Home/workspace/Build and test new commits on develop
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url # timeout=10
Fetching upstream changes from
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from
at hudson.plugins.git.GitSCM.fetchFrom(
at hudson.plugins.git.GitSCM.retrieveChanges(
at hudson.plugins.git.GitSCM.checkout(
at hudson.scm.SCM.checkout(
at hudson.model.AbstractProject.checkout(
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
at jenkins.scm.SCMCheckoutStrategy.checkout(
at hudson.model.AbstractBuild$
at hudson.model.Run.execute(
at hudson.model.ResourceController.execute(
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*" returned status code 143:stdout:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(
at hudson.plugins.git.GitSCM.fetchFrom(
... 11 more
ERROR: null
Finished: FAILURE

Answer Source

Please check if user jenkins exists on your OS and it has right permissions.

How to set up jenkins user on Mac OS X:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download