The Cause Of My “‘/.git/index.lock’: File Exists” Error

December 18th, 2013 - Posted by Steve Marks to Software, Web Development.

When working with a new site in git earlier today I kept getting an error popup every few minutes when trying to do such actions as add files to a commit, or perform a rebase. The error read as follows:

fatal: Unable to create '/path/to/site/.git/index.lock': File exists.
If no other 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.

The odd thing was that if I tried to perform the same operation again a few seconds later I then wouldn’t get this message. There also was no ‘index.lock‘ file to delete as the error message above recommends.

The Solution

After ignoring this intermittent error for a while I soon remembered that the Aptana coding IDE I use integrates with git and displays a repository’s status from within the GUI.

After closing either the project in question from Aptana, or shutting down Aptana altogether, I then no longer got this error message.

I’m either going to have to find a way to disable git from within Aptana, or start making commits etc from Aptana itself. I’m unsure which is going to be easier in the long run but will update this post if I find a suitable workaround.

Update (6th Jan 14) – Disconnecting git in Aptana

Ok, so I found a way to disconnect git from projects in Aptana 3. It’s actually really straightforward and can be done by following the steps below:

1. Open Aptana and the project in question.
2. Right-click the project
3. Navigate to and hover over the ‘Team’ menu item.
4. At the bottom of the submenu is a ‘Disconnect’ option.
5. Click this and git will no longer create locks.

Tags: ,
This entry was posted on Wednesday, December 18th, 2013 at 10:41 pm by +Steve Marks and is filed under Software, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.

Fear not, we won't publish this

Comments (0)

No comments have been left yet. Be the first