mcgrailm mcgrailm - 1 year ago 93
Git Question

How do I fix a failed git commit?

I am new to

and was trying to commit, but I got stuck in what looked like
which I'm not familiar with. I managed to get out of it, but I think I got out the wrong way because my git status says "changes not staged," but I still can't try again. Could someone tell me what I can do to fix the still hanging process and commit my changes?

here is the 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.

not i took out the full path

As always thanks for your help.

Answer Source

Assuming you're not doing anything with git at the moment (i.e., not doing a push or pull or running a git script in the repository, for any reason), you could just remove the lock file manually and try again.

Also, git expects a "commit message" describing your changes. Assuming you don't want an editor to open, you can provide an inline message using the -m option:

git commit -am "Changed this, that, and the other thing"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download