Git LFS Repo Fails To Checkout On Jenkins With Status Code 130

320 views Asked by At

I have several CIs set up on Jenkins to simply checkout master from a git LFS repo when there are new commits. Every time the job builds however, it fails with the following error message:

Checking out Revision <hash> (origin/master)
 > C:\Program Files\Git\cmd\git.exe config core.sparsecheckout # timeout=10
 > C:\Program Files\Git\cmd\git.exe checkout -f <commit> # timeout=10
ERROR: Timeout after 10 minutes
FATAL: Could not checkout <commit>
hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe checkout -f <commit>" returned status code 130:
stdout: 
stderr: fatal: Unable to read prompt input from standard input [0xe9]
fatal: No process is on the other end of the pipe

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2842)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:3170)
Caused: hudson.plugins.git.GitException: Could not checkout <commit>
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:3198)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1355)
    at hudson.scm.SCM.checkout(SCM.java:540)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1245)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521)
    at hudson.model.Run.execute(Run.java:1900)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
    at hudson.model.ResourceController.execute(ResourceController.java:101)
    at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE

This is only occurring on CIs checking out lfs repos. Non-lfs repos work just fine. These repos are being hosted on Bitbucket.

After failure, I can manually perform a workaround on my Jenkins instance and retrigger the job by running these git commands:

sometimes works:

git clean -f
git pull origin master

often works:

git reset --hard HEAD~1
git pull origin master

always works:

git fetch --all
git reset --hard origin/master

or

git fetch
git checkout -f origin/master     
git checkout master               
git pull origin master   

Attempted Fix #1: Clean Before Checkout

I tried enabling Clean before checkout on my CI jobs since a clean often worked to fix the issue, but the checkout still failed in the same way.

Attempted Fix #2: Creating Duplicate Jobs/Workspaces

Wondering if there was some hidden bloat or caching issues, I created new workspaces, re-cloned the repos, and created new duplicate CI jobs, but these still failed straight away.

Attempted Fix #3: Disabling Git LFS Prompting

In the Jenkins environment, I set GIT_TERMINAL_PROMPT to 0. This did not fix my issues but it did change the error message to fatal: Cannot prompt because terminal prompts have been disabled as you might expect.

Attempted Fix #4: Skipping Smudge (or Git LFS Batch Mode)

In another attempt to avoid prompts, I set GIT_LFS_SKIP_SMUDGE to 1. This actually did clear up my error and enabled the jobs to succeed, but I can't go with this option because downstream jobs depend on having access to the files these CIs pull so I can't simply download pointers/placeholders as skip smudge does.

0

There are 0 answers