[Solved] fatal: Unable to create '.git/index.lock': File exists

APRIL 2, 2022

I was getting this error when trying to git add and git commit code changes in my repository.

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

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

Simply removing the .git/index.lock file made everything go back to normal.

rm .git/index.lock

Nothing broke and I could immediately add and commit new files.