fatal: Unable to create 'your_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.
What should be the resolution to get rid of this error:
- Open terminal & go to the path where your project is.
- Type ls command and check if there is a .git folder. This is a hidden folder. Make sure you have enabled flag to see hidden files. If not check this blog – How to show hidden files and folders in Mac OS-X-Finder.
- Type cd .git it will enter into the .git directory.
- Type ls command to check the files.
- You will see there is a file index.lock
- Type rm -f index.lock command to delete the file. This will delete the file. Make sure you have the ownership. Otherwise Type sudo rm -f index.lock Enter password.
- Type cd ..
- Type git commit to commit again.