詹金斯 git 获取超时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36017253/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:52:03  来源:igfitidea点击:

Jenkins git fetch timeout

gitjenkinsjenkins-2

提问by Colin Basnett

I am running Jenkins 2.0 on my Mac OS X Mavericks machine at work. I'm trying to pull down a repository from an internal server. However, the job hangs on the git fetchcall for 10 minutes and then times out.

我正在工作时在 Mac OS X Mavericks 机器上运行 Jenkins 2.0。我正在尝试从内部服务器拉下存储库。但是,该作业在git fetch通话中挂起10 分钟,然后超时。

If I manually run git cloneor git fetchfrom a shell script (from within Jenkins), I get the same overall result, except the job hangs endlessly.

如果我手动运行git clonegit fetch从 shell 脚本(从 Jenkins 内部)运行,我会得到相同的总体结果,除了工作无休止地挂起。

I can run a cloneor fetchcommand from the Terminal just fine.

我可以从终端运行一个cloneorfetch命令就好了。

I'm wondering if this is some sort of user permission error that needs to be resolved.

我想知道这是否是某种需要解决的用户权限错误。

Here is the log:

这是日志:

Started by user Colin Basnett
Building in workspace /Users/Shared/Jenkins/Home/workspace/Service
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://192.168.4.40/Bonobo.Git.Server/Service.git # timeout=10
Fetching upstream changes from http://192.168.4.40/Bonobo.Git.Server/Service.git
 > git --version # timeout=10
using .gitcredentials to set credentials
 > git config --local credential.username jenkins # timeout=10
 > git config --local credential.helper store --file=/Users/Shared/Jenkins/tmp/git8010092725741498465.credentials # timeout=10
 > git -c core.askpass=true fetch --tags --progress http://192.168.4.40/Bonobo.Git.Server/Service.git +refs/heads/*:refs/remotes/origin/*
 > git config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from http://192.168.4.40/Bonobo.Git.Server/Service.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress http://192.168.4.40/Bonobo.Git.Server/Service.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: Authentication failed for 'http://192.168.4.40/Bonobo.Git.Server/Service.git/'

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:63)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:314)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
    ... 11 more
ERROR: null
Finished: FAILURE

Thank you in advance for any assistance.

预先感谢您的任何帮助。

回答by Ivan Leonenko

For me it was short timeout. In your case you may want to do the following:

对我来说,这是短暂的超时。在您的情况下,您可能需要执行以下操作:

  1. Increase timeout for cloning and checkout
    1. Go to job configuration and find git section
    2. Add -> Advanced clone behaviours. There you can specify timeout and check 'shallow copy' (which is faster)
    3. Add -> Advanced checkout behaviours. You can set time out for checkout.
  2. Make sure you provided right credentials in Job configuration - Source Code Management - Git - Credentials
  1. 增加克隆和检出的超时时间
    1. 转到作业配置并找到 git 部分
    2. 添加 -> 高级克隆行为。在那里您可以指定超时并检查“浅拷贝”(更快)
    3. 添加 -> 高级结帐行为。您可以设置结帐时间。
  2. 确保您在作业配置 - 源代码管理 - Git - 凭据中提供了正确的凭据