27

We are experiencing slow git fetch commands on a Jenkins installation on Windows Server 2012. I have tried all the solutions mentioned in these threads:

Anyone been able to find a solution to this with a permanent fix?

Console output log from Jenkins:

Started by remote host

Building on master in workspace F:\Jenkins\jobs\xxx\workspace

> git.exe rev-parse --is-inside-work-tree # timeout=10

Fetching changes from the remote Git repository

> git.exe config remote.origin.url xhttp://scm/git/xxx # timeout=10

Fetching upstream changes from xhttp://scm/git/xxx

> git.exe --version # timeout=10

using .gitcredentials to set credentials

> git.exe config --local credential.helper store --file=\"C:\Users\APP_JE~1\AppData\Local\Temp\git7476037793811743133.credentials\" # timeout=10

> git.exe -c core.askpass=true fetch --tags --progress xhttp://scm/git/xxx +refs/heads/:refs/remotes/origin/

PROBLEM HERE: The above command can take between 30 seconds to 120 seconds. On a local dev machine it takes a few seconds.

> git.exe config --local --remove-section credential # timeout=10

Version info:

Jenkins: 1.608 (latest)

Windows: Server 2012

Git: 1.9.5 (latest for Windows xhttp://git-scm.com/download/win)

Git Client plugin for Jenkins : 1.16.1 (latest)

Git plugin for Jenkins: 2.3.5 (latest)

Jenkins is running as a domain user which has administrator access on the server

Community
  • 1
  • 1
Thomas T
  • 697
  • 1
  • 7
  • 19
  • Did you try to reinstall git as mentioned [here][1] ? [1]: http://stackoverflow.com/a/4506192/779338 – Nelson G. Jul 03 '15 at 20:12
  • Yes i have tried that. It doesn't help. I also applied these 3 config options without luck: `$ git config --global core.preloadindex true` `$ git config --global core.fscache true` `$ git config --global gc.auto 256` – Thomas T Jul 19 '15 at 09:32
  • Is you server behind a different proxy than the local machines? We sometimes have issues with our proxy scanning all the files, which takes some time. – michaelbahr Jul 20 '15 at 09:28
  • @michaelbahr no, it is not. Running the command manually from the server with git Bash is no problem. This is an issue with git & Jenkins combined. – Thomas T Jul 20 '15 at 12:30
  • Any update on this Thomas? We're seeing the same thing here. – Webjedi Aug 18 '15 at 23:08
  • Not yet @Webjedi. Will try DavidNeiss answer when i return from holidays. – Thomas T Aug 29 '15 at 12:52

3 Answers3

9

Version 2.6.1 of the Git client for Windows fixes this problem. Now it's running blazingly fast!

I am using the git cmd in Jenkins from:

C:\Program Files\Git\cmd\git.exe

Thomas T
  • 697
  • 1
  • 7
  • 19
  • Finally! This has been messing with my mind for almost two years now! – berkus Dec 04 '15 at 07:11
  • 1
    Where is version 2.6.1? As of today, Git appears to be at 2.26.0. I am still experiencing slow fetches with this latest version. Even after setting the --depth to 1 through 'Advanced Clone behaviors' and increasing the timeout. – lkisac Apr 03 '20 at 19:05
2

Use Advanced clone behaviors and enable the checkbox for "Do not fetch tags" if you don't need them. Git should still checkout the branch/tag you specify.

David I.
  • 4,747
  • 3
  • 26
  • 34
1

Try to enable some of GIT's debug/performance flags to get more info on where things are taking time inside of its plumbing, see https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables. For instance, export GIT_TRACE=1 and also try GIT_TRACE_PERFORMANCE and GIT_TRACE_PACKET.

David Neiss
  • 8,161
  • 2
  • 20
  • 21
  • 7
    Any idea how i would enable these flags with the Jenkins Git plugin, and how to see the output of these flags afterwards? – Thomas T Sep 07 '15 at 07:38