简体   繁体   中英

Unable to clone Git repository in Jenkins, request timed out

Not sure why Jenkins is unable to fetch the repo from Bitbucket server. I am running Git for Windows in the Jenkins slave. Using latest Jenkins Community LTS edition ie 2.107.2. Please see below the error log -

23:39:06 ERROR: Timeout after 10 minutes
23:39:07 ERROR: Error fetching remote repo 'origin'
23:39:07 hudson.plugins.git.GitException: Failed to fetch from https://xxx/stash/xyz.git
23:39:07    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:862)
23:39:07    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1129)
23:39:07    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
23:39:07    at hudson.scm.SCM.checkout(SCM.java:504)
23:39:07    at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
23:39:07    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
23:39:07    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
23:39:07    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
23:39:07    at hudson.model.Run.execute(Run.java:1727)
23:39:07    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
23:39:07    at hudson.model.ResourceController.execute(ResourceController.java:97)
23:39:07    at hudson.model.Executor.run(Executor.java:429)
23:39:07 Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --tags --progress https://xxx/stash/xyz.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:

make sure you've configured both(master and slave) properly when using master-slave configuration and trying to use git clone or whatever.

  • on master: git should be installed
  • on slave: git should be installed and configured in master nodes configuration:
    Manage Jenkins> Manage Nodes > windowsnodename > configure
    for example:

在此处输入图片说明

The issue was large number of open branches (~170) in Bitbucket. Due to which git operation was timed out. After deleting obsolete branches (~60) it started working.

Just to add my 2 cents to the already solution answers in case someone faces the same problem. In my case was not too many branches opened but the size of the repository. I had some hidden files inside a hidden folder starting with .<\/code> -> .terraform<\/code> that were unnecessary committed. The files together were about 40MB<\/code> . after deleting those files and adding the .terraform<\/code> to the .gitignore<\/code> Jenkins CI pipeline could clone the repo without problems.

"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM