简体   繁体   中英

Jenkins job failing with Caused by: hudson.plugins.git.GitException: checkout -f returned status code -1

I am running Jenkins on windows and trying to download the code from Git through jenkins, the following error occurs. I tried configuring the "Additional Behaviours" to 'Advance clone behaviours' with options - 'shallow clone' and 'Timeout (in minutes) for clone and fetch operations :60' but still the job is failing with below error

Checking out Revision c340e8f017689f723b19c2b479d7db7c3e66591d (origin/develop)

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

I followed @dildeepak advice and I found that my problem was git was complaining on long file names.

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

To find out what the root cause for your problem is, do the following

Stop Jenkins

Edit

JENKINS_INSTALL_FOLDER/jenkins.xml

Add -Dhudson.plugins.git.GitSCM.verbose=true to <arguments> tag

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

Start Jenkins

Now run your build job, and look at the console output for more detailed error message. You will spot the root cause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM