Search code examples
git

Another Git process seems to be running in this repository


I'm trying to learn how to use Git and have created a small project with an HTML, CSS, and JavaScript file. I made a branch from my basically empty project and then made some changes to my code. I tried staging the changes, but I get the following error message:

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.

Granted, I did run into problems trying to commit my empty project earlier and just quit Git Bash since I didn't know how to get out of where I somehow had gotten.

Is there a way for me to fix this or should I just start a new repository?


Solution

  • Try deleting index.lock file in your .git directory or in one of your worktrees .git/worktrees/*/index.lock if you are in a worktree.

    rm -f .git/index.lock
    

    Such problems generally occur when you execute two git commands simultaneously; maybe one from the command prompt and one from an IDE.