Jenkins git fetch timeout
Asked Answered
K

1

20

I am running Jenkins 2.0 on my Mac OS X Mavericks machine at work. I'm trying to pull down a repository from an internal server. However, the job hangs on the git fetch call for 10 minutes and then times out.

If I manually run git clone or git fetch from a shell script (from within Jenkins), I get the same overall result, except the job hangs endlessly.

I can run a clone or fetch command from the Terminal just fine.

I'm wondering if this is some sort of user permission error that needs to be resolved.

Here is the log:

Started by user Colin Basnett
Building in workspace /Users/Shared/Jenkins/Home/workspace/Service
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://192.168.4.40/Bonobo.Git.Server/Service.git # timeout=10
Fetching upstream changes from http://192.168.4.40/Bonobo.Git.Server/Service.git
 > git --version # timeout=10
using .gitcredentials to set credentials
 > git config --local credential.username jenkins # timeout=10
 > git config --local credential.helper store --file=/Users/Shared/Jenkins/tmp/git8010092725741498465.credentials # timeout=10
 > git -c core.askpass=true fetch --tags --progress http://192.168.4.40/Bonobo.Git.Server/Service.git +refs/heads/*:refs/remotes/origin/*
 > git config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from http://192.168.4.40/Bonobo.Git.Server/Service.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress http://192.168.4.40/Bonobo.Git.Server/Service.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: Authentication failed for 'http://192.168.4.40/Bonobo.Git.Server/Service.git/'

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
    ... 11 more
ERROR: null
Finished: FAILURE

Thank you in advance for any assistance.

Ketch answered 15/3, 2016 at 16:45 Comment(2)
According to the log, the git command sets the option core.askpass=true. Thus git is waiting for a password which is never given.Cumshaw
I saw there is an error in the log "fatal: Authentication failed for '192.168.4.40/Bonobo.Git.Server/Service.git'", maybe need to check the Jenkins git configuration first. For me the path to set Jenkins git configurations: Manage Jenkins - Configurate System - Gitlab(Since we're using gitlab server) - CredentialsFulguration
P
31

For me it was short timeout. In your case you may want to do the following:

  1. Increase timeout for cloning and checkout
    1. Go to job configuration and find git section
    2. Add -> Advanced clone behaviours. There you can specify timeout and check 'shallow copy' (which is faster)
    3. Add -> Advanced checkout behaviours. You can set time out for checkout.
  2. Make sure you provided right credentials in Job configuration - Source Code Management - Git - Credentials
Promontory answered 18/11, 2016 at 13:59 Comment(3)
Hey, thanks! I was agonizing with this trouble for 2 days. I use Bitbucket folder, pipelines and autobuiding PRs. Your advice helped me to remove this issue: ERROR: Error fetching remote repo 'origin'Jacquelynejacquelynn
Default timeout value (10 minutes) is a bit confusing (I'd expect something like ten seconds). Anyway, shallow mode really helps when GitHub connection is unstable.Shipshape
Didn't know about the shallow copy as well. This makes the checkout process significantly faster.Cyprinoid

© 2022 - 2024 — McMap. All rights reserved.