【问题标题】:Jenkins job failing with Caused by: hudson.plugins.git.GitException: checkout -f returned status code -1Jenkins 作业失败,原因是:hudson.plugins.git.GitException: checkout -f 返回状态码 -1
【发布时间】:2018-03-28 07:41:11
【问题描述】:

我在 windows 上运行 Jenkins 并尝试通过 jenkins 从 Git 下载代码,出现以下错误。我尝试使用选项将“其他行为”配置为“高级克隆行为”-“浅克隆”和“克隆和获取操作的超时(以分钟为单位):60”,但作业仍然失败并出现以下错误

检查修订版 c340e8f017689f723b19c2b479d7db7c3e66591d(起源/开发)

c:\programs\Git\bin\git.exe config core.sparsecheckout # timeout=10 c:\programs\Git\bin\git.exe checkout -f c340e8f017689f723b19c2b479d7db7c3e66591d

ERROR: Timeout after 10 minutes
FATAL: Could not checkout c340e8f017689f723b19c2b479d7db7c3e66591d
hudson.plugins.git.GitException: Could not checkout c340e8f017689f723b19c2b479d7db7c3e66591d
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2031)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:332)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:85)
    at java.lang.Thread.run(Unknown Source)
    at ......remote call to jenkins10(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
    at hudson.remoting.Channel.call(Channel.java:781)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
    at sun.reflect.GeneratedMethodAccessor559.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
    at com.sun.proxy.$Proxy58.execute(Unknown Source)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1033)
    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 "c:\programs\Git\bin\git.exe checkout -f c340e8f017689f723b19c2b479d7db7c3e66591d" returned status code -1:
stdout: 
stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1752)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$800(CliGitAPIImpl.java:64)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2023)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:332)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:85)
    at java.lang.Thread.run(Unknown Source)
Finished: FAILURE

【问题讨论】:

  • 看起来是 Jenkins 的 github 插件中的一个已知问题。 issues.jenkins-ci.org/browse/JENKINS-26290
  • 尝试通过使用 "-Dhudson.plugins.git.GitSCM.verbose=true" 启动 Jenkins 来进行诊断。它将帮助您了解错误的根本原因。
  • @dildeepak :感谢您的回复。我对 jenkins 很陌生,请指导我在哪里可以添加“-Dhudson.plugins.git.GitSCM.verbose=true”参数,这会为该问题提供高级日志记录吗?没找到具体的解决方案,推荐安装最新的Jenkins/Git插件吗,我目前的Git插件是2.3.5。

标签: git jenkins


【解决方案1】:

我遵循了@dildeepak 的建议,发现我的问题是 git 抱怨长文件名。

stdout: 
stderr: error: unable to create file Referenced Packages/CloudSense Contract Lifecycle Management Data Model/layouts/Document_Template_Section_Association__c-Document Template%2FSection Association 
Layout.layout: Filename too long

要找出问题的根本原因,请执行以下操作

停止詹金斯

编辑

JENKINS_INSTALL_FOLDER/jenkins.xml

-Dhudson.plugins.git.GitSCM.verbose=true 添加到<arguments> 标记

<arguments>...... -Dhudson.plugins.git.GitSCM.verbose=true</arguments>

启动詹金斯

现在运行您的构建作业,并查看控制台输出以获取更详细的错误消息。你会发现根本原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-29
    • 2012-02-03
    • 2016-02-07
    • 1970-01-01
    • 2017-03-23
    • 2019-04-12
    • 2021-10-16
    相关资源
    最近更新 更多