18

I was committing my git process and thought that it would be okay if I ignore comments so I used this code

git commit filename

Bash was strange and thus i closed the console now when I use proper command

git commit -m"THIRD COMMIT" filename

It give the following response:

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:

what should I do?

Ayush Mahajan
  • 639
  • 1
  • 5
  • 14
  • Does the error message mention a lock file? – janos Nov 06 '16 at 14:26
  • @JeffPuckettII thanks but method I mentioned is working. And I learned it from youtube. Link is [link](https://www.youtube.com/watch?v=J_Clau1bYco) If there is something wrong with the method, do you mind putting some light on the topic. – Ayush Mahajan Nov 07 '16 at 06:01

10 Answers10

43

I met this problem recently too.

rm -f ./.git/index.lock

try this commend in your git bash, then you can solve your problem.

Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
liuguangsen0409
  • 446
  • 4
  • 2
8

Removing the index.lock like it was recommended in this answer of another question should solve your problem.

Community
  • 1
  • 1
Gersee
  • 806
  • 3
  • 15
  • 30
  • 2
    I tried that solution and that is why I am here. I cannot find index.lock anywhere. I did read all related questions on stackoverflow before asking it. – Ayush Mahajan Nov 07 '16 at 05:58
  • It does not though. I can find index.lock file but deleting it does not change anything – pixel Nov 08 '16 at 22:15
4
  1. In windows, change settings to view hidden folders
  2. Navigate inside .git folder
  3. Manually delete .lock file
devendra
  • 79
  • 2
2

This helps to avoid the below 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."

Even in windows when I tried deleting the index.lock file, the git reset --hard HEAD command was executing without any hindrance.

del index.lock git reset --hard HEAD

Previously when I was running the checkout process inside this repository , I had to disconnect in middle of the process. So this might be the cause for this issue.

1

It happened for me when I run pull from GIT command and got conflicts and try to revert them by the TortoiseGIT client. I resolved this by running below code at root folder level of my repo

rm .git/index.lock

Hope this is helpful.

dush88c
  • 1,918
  • 1
  • 27
  • 34
0

I have same faced issues when i tried to staged file in SourceTree.

To solve this go to the .git folder in the project directory and manually delete index.lock and you are done.

Rokan Nashp
  • 331
  • 4
  • 13
0

The commands didn't seem to work for me so I navigated to the root folder of my project, viewed hidden files, then navigated to .git/ to delete index.lock, I rerun git commit -m"THIRD COMMIT" filename and that was it!

0

In case you stopped the rebase before it was finished you can run this command on the git bash on the .git folder:

rm REBASE_HEAD.lock

Kevin Oswaldo
  • 478
  • 5
  • 13
0

In my case, i opened Git Bash (on windows) and run this command rm .git/index.lock after can use git add whith normaly

webklazz
  • 11
  • 2
-2

check .gitignore files . When I tried to find the error I found and fixed it.