user1760561 user1760561 - 3 years ago 247
Git Question

remove .git/index.lock': Permission denied

I'm completely stuck as to why my git has completely locked me out. I have a laptop that I use at work and when I'm home. For both accounts I use git extensively and both are located in different paths. Today I came into work and I can't do anything, all I see is:

/Applications/MAMP/htdocs/my_site/.git/index.lock': Permission denied


For all I care the branch I'm on can be deleted. I've tried removing the branch, checking out any other branch, removing the index.lock file (as suggested by other users on sites). I only have the terminal window open, no other possible programs using git (as far as I know and nothing noticeable in the activity window). I have rebooted the computer straight into my work account and still no luck. How can I remove this lock?

Answer Source

Check which user owns the git lock:

ls -la /Applications/MAMP/htdocs/my_site/.git/index.lock

Then you can use sudo to remove it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download