Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins (Windows) very slow Git fetch

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:

  • Hudson git commands are *incredibly* slow (Using plink.exe from PuTTY and setting GIT_SSH to use that)

  • Jenkins hanging at "Fetching upstream changes from origin" (Changed Jenkins to use cmd\git.exe instead of bin\git.exe)

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

like image 618
Thomas T Avatar asked Apr 13 '15 06:04

Thomas T


3 Answers

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

like image 51
Thomas T Avatar answered Nov 15 '22 06:11

Thomas T


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.

like image 41
David I. Avatar answered Nov 15 '22 07:11

David I.


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.

like image 22
DavidN Avatar answered Nov 15 '22 05:11

DavidN