2

I don't know what happened to my system because from last week it is giving this error continuously 2-3 times on daily basis.

fatal: Unable to create '/path/to/repo/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

I have remove this is file every time and currently it became a big pain for me.

Can anybody explain why it is happening continuously or what are its expected causes/reasons or anything that can help me to avoid this thing, at least on daily bases it should not happen.

Manoj Sehrawat
  • 1,283
  • 1
  • 10
  • 25
  • Did you run as Sudo? May not have permissions to manage the file. – Nathaniel D. Waggoner Jan 29 '14 at 15:21
  • `sudo` where.?? I am the admin of my system and I don't why all of a sudden it just start happening from last few days :-( – Manoj Sehrawat Jan 29 '14 at 15:29
  • 1
    possible duplicate of [Git - fatal: Unable to create '/path/my\_project/.git/index.lock': File exists.](http://stackoverflow.com/questions/7860751/git-fatal-unable-to-create-path-my-project-git-index-lock-file-exists) – devnull Jan 29 '14 at 15:30
  • I would just check the permissions anyway. If there's something weird in the in file ownership try modifying it. You've already found the solution (deletion) in the linked comment so I think your issue is slightly different. – Nathaniel D. Waggoner Jan 29 '14 at 15:33
  • 2
    @devnull - I know the work around of the issue but I wanted to know the reason like why this is happening. So the purpose of this question is different. I couldn't find the reason anywhere thats why I posted this question. – Manoj Sehrawat Jan 30 '14 at 05:39
  • What is your platform ? – xryl669 Nov 13 '15 at 12:57

1 Answers1

0

I've seen this happen several times in the office.

Basically, what happened here was - a git console command was inputted, while at the same time a visual client was running some command on its own. In the end both fail to delete the index.lock file, without any other side effects of problems caused.

I usually just deleted my original index file and replaced it with the index.lock version just in case.

Jordan Parker
  • 239
  • 3
  • 8