11

When I'm trying to commit my work from inside sublime it gives me the following message:

fatal: Unable to create 'my_project_path/.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 checked that but the index.lock is not exists at all! and when I commit in terminal everything is good.

any ideas?

Raeef Refai
  • 1,471
  • 14
  • 26
  • 1
    Is there a permission issue? (does sublime text runs with your account?) Removing the file should be enough (http://stackoverflow.com/a/20827294/6309), but in your case, check if there isn't any "git" processes running (ps -ef|grep git) – VonC Sep 03 '14 at 06:02
  • honestly, I don't know if it's a permission issue or not. I used the command as you mentioned: **ps -ef|grep git** and got the following results: **raeef 32550 27757 0 09:19 pts/3 00:00:00 grep --color=auto git** if this is another process, so how to stop it? and why it's not affecting when I commit in the terminal? – Raeef Refai Sep 03 '14 at 06:32
  • It appears by that output another git process is not running. I believe at this point it is a permissions issue or a problem with the version of Git you are using with Sublime Text. – jtl999 Sep 03 '14 at 06:52
  • my sublime version is **3 build 3065** and tried on **build 3059**, git package is **v2014.07.13.22.18.27** and git version is **2.1.0** if it's permissions issue, any idea how to solve it? – Raeef Refai Sep 03 '14 at 07:51
  • Does the index.lock file still exist if you go check for it? (If it does, that's indicative of a command having aborted. If it doesn't, two commands might be trying to run simultaneously.) – David Sep 09 '14 at 15:30
  • have a tried a different git build? – Chris Sep 10 '14 at 07:12
  • No, but are you sure that I need different git build while it's 100% working in terminal? – Raeef Refai Sep 10 '14 at 08:17

2 Answers2

2

Try this

rm -f my_project_path/.git/index.lock

Sometimes, there is inconsistencies preventing git to release the lock, you also, just in case, should run git consistence checks to make sure your local git repo is consistent:

git fsck
dseminara
  • 11,665
  • 2
  • 20
  • 22
1

I downgraded git from 2.1.0 to 1.9.1 and all good now.

Raeef Refai
  • 1,471
  • 14
  • 26