Monthly Archives: August 2013

Git cleanup of already locked files

Taken from

If you have either manually or by accident “breaked” in the midst of a git add or git commit, most likely the lock file of the file you attempted to git add/commit still exists, preventing you from further action on that file. There’s an easy way to solve this.


L-MAC-DEYNON:my_project_dir deynon$ git add data/reports
fatal: Unable to create '/Users/deynon/Projects/dir_1/.git/index.lock': File exists.
If no other git process is currently running, this probably means agit process crashed in this repository earlier. Make sure no other gitprocess is running and remove the file manually to continue.


Delete the …/.git/index.lock file… and git reset…

L-MAC-DEYNON:test_and_target deynon$ rm /Users/deynon/Projects/dir_1/.git/index.lock
L-MAC-DEYNON:test_and_target deynon$ git reset

And you should be good!