Git index.lock File exists when I try to commit, but I cannot delete the file

git

Solution

On Linux, Unix, Git Bash, or Cygwin, try:

`rm -f .git/index.lock`

On Windows Command Prompt, try:

`del .git\index.lock`

Problem

When I do 'git commit', I'm getting the following: `fatal: Unable to create 'project_path/.git/index.lock': File exists.` However, when I do `ls project_path/.git/index.lock` it's saying the file doesn't exist. What should I do? I've also noticed that project_path/.git is owned by root and am not sure if that has anything to do with the problem I'm encountering. The Git version is 1.7.5.4 It seems that the problem most likely was another process I had running, that was writing (unbeknownst to me) to the project directory. I restarted my machine and then I had no problem committing.

Original source

Related problems