Issue
During a checkout operation, the checkout process fails with the following error:
ERROR: Checkout failed hudson.plugins.git.GitException: Command "git checkout -f ..." returned status code 128: stdout: stderr: fatal: Unable to create /var/jenkins_home/workspace/.../.../.git/index.lock': File exists.
Resolution
This typically happens if a controller or agent goes offline while the job is running and the failing controller/agent is not able to complete the process of removing the index.lock
file. Removing this file manually from the workspace mentioned (/var/jenkins_home/workspace/…/…/.git/index.lock
) should unblock this build.
Please remove this file manually and try running the checkout step again.
Tested product/plugin versions
-
CloudBees CI on modern cloud platforms - managed controller 2.426.3.3
-
git 5.2.1
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.