Just delete the file called index.lock which is in the .git folder. After you delete it, try to commit again.
Steps
- Navigate to the desired folder in your file explorer
- Go to folder options and tick on “Show Hidden Files” (this might have a different name depending on your OS)
- There will be a
.gitfolder shown to you. Just go and delete theindex.lockfile from there and you are ready to commit again.