詹金斯(Windows)Git fetch 非常慢
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29598871/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jenkins (Windows) very slow Git fetch
提问by Thomas T
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:
我们在 Windows Server 2012 上的 Jenkins 安装上遇到了缓慢的 git fetch 命令。我已经尝试了这些线程中提到的所有解决方案:
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)
Hudson git 命令非常慢(使用 PuTTY 中的 plink.exe 并设置 GIT_SSH 以使用它)
Jenkins 挂在“从原点获取上游更改”(更改 Jenkins 以使用 cmd\git.exe 而不是 bin\git.exe)
Anyone been able to find a solution to this with a permanent fix?
任何人都能够通过永久修复找到解决方案?
Console output log from Jenkins:
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/
由远程主机启动
在工作区 F:\Jenkins\jobs\xxx\workspace 中的 master 上构建
> git.exe rev-parse --is-inside-work-tree # timeout=10
从远程 Git 存储库获取更改
> git.exe 配置 remote.origin.url xhttp://scm/git/xxx # timeout=10
从 xhttp://scm/git/xxx 获取上游更改
> git.exe --version # timeout=10
使用 .gitcredentials 设置凭据
> 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.
问题在这里:上述命令可能需要 30 秒到 120 秒。在本地开发机器上需要几秒钟。
> git.exe config --local --remove-section credential # timeout=10
> git.exe 配置 --local --remove-section 凭据 # 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)
詹金斯:1.608(最新)
视窗:Server 2012
Git:1.9.5(Windows 最新版本 xhttp://git-scm.com/download/win)
Jenkins 的 Git 客户端插件:1.16.1(最新)
Jenkins 的 Git 插件:2.3.5(最新)
Jenkins is running as a domain user which has administrator access on the server
Jenkins 以域用户身份运行,该用户在服务器上具有管理员访问权限
采纳答案by Thomas T
Version 2.6.1 of the Git client for Windowsfixes this problem. Now it's running blazingly fast!
适用于 Windows 的 Git 客户端 2.6.1 版修复了此问题。现在它运行得非常快!
I am using the git cmd in Jenkins from:
我在 Jenkins 中使用 git cmd 来自:
C:\Program Files\Git\cmd\git.exe
C:\Program Files\Git\cmd\git.exe
回答by David I.
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.
如果不需要,请使用高级克隆行为并启用“不获取标签”复选框。Git 仍应检出您指定的分支/标签。
回答by DavidN
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.
尝试启用一些 GIT 的调试/性能标志以获取有关其管道内部哪些地方花费时间的更多信息,请参阅https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables。例如,export GIT_TRACE=1
还可以尝试 GIT_TRACE_PERFORMANCE 和 GIT_TRACE_PACKET。