-->

fatal: Unable to create '/.git/index.lock'

2020-07-09 08:12发布

问题:

When I try to rename any image name in my Xcode Project it gives following error.

fatal: Unable to create '/.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.

Don't know what is going wrong. Thanks in Advance.

回答1:

Try

rm -f ./.git/index.lock

In your repository directory.



回答2:

I had my local repo inside a Wordpress plugin folder hosted by Mamp on osx. The permissions for the local server was set to "www" in the Mamp permission settings. I changed the permissions back to me, and the "/index.lock“ needs to be removed manually."-problem went away.



回答3:

For me, $rm index.lock while in my git repository also solved the problem