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

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


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.