`fatal: Unable to create '/repo/.git/index.lock': File exists.`
BeginnerTroubleshootingLost Work, HEAD and History Problems
Answer
Likely causes → Another Git process is running (IDE, GUI client, background fetch), or a previous command crashed and left the lock file.
Diagnose →
ps aux | grep -i '[g]it'
ls -l .git/index.lock
Fix → If no Git process is running, remove the stale lock: rm .git/index.lock. If one is running, wait or close that tool.
Prevent → Avoid running parallel Git operations from several tools, and do not kill Git mid-operation.
More on Lost Work, HEAD and History Problems
You added a file to `.gitignore`, but `git status` still shows it as modified.Beginner`fatal: your current branch 'main' does not have any commits yet`Beginner`Author identity unknown *** Please tell me who you are.` and `fatal: unable to auto-detect email address`Beginner`fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.`BeginnerYour commits do not show on your GitHub profile contribution graph.Intermediate`fatal: 'main' is already checked out at '/home/dev/app-hotfix'`Intermediate