Jenkins (Windows) 获取速度非常慢 Git

Jenkins (Windows) very slow Git fetch

我们在 Windows Server 2012 上安装的 Jenkins 上遇到缓慢的 git 获取命令。我已经尝试了这些线程中提到的所有解决方案:

有人能够通过永久性修复找到解决方案吗?

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/

这里的问题:上面的命令可能需要 30 秒到 120 秒。在本地开发机器上需要几秒钟。

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

版本信息:

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 运行 作为域用户在服务器上具有管理员访问权限

尝试启用一些 GIT 的 debug/performance 标志,以获取有关管道内部哪些地方需要时间的更多信息,请参阅 https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables。例如,export GIT_TRACE=1 并尝试 GIT_TRACE_PERFORMANCE 和 GIT_TRACE_PACKET。

Version 2.6.1 of the Git client for Windows 修复了这个问题。现在 运行 快得惊人!

我在 Jenkins 中使用 git cmd 来自:

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

使用高级克隆行为并在不需要时启用 "Do not fetch tags" 的复选框。 Git 仍应检查您指定的 branch/tag。