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.