Another git process seems to be running and thus cant commit

53,139

Solution 1

I met this problem recently too.

rm -f ./.git/index.lock

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

Solution 2

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

Solution 3

  1. In windows, change settings to view hidden folders
  2. Navigate inside .git folder
  3. Manually delete .lock file

Solution 4

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.

Solution 5

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.

Share:
53,139
Ayush Mahajan
Author by

Ayush Mahajan

I am in freshman year and I am passionate about computer programming. I love to solve programming question but truth is that I love to do something on which I stuck rather than something I am good at because these moments teach me. I love making programs more interactive and cooler. I code whenever I am free. I love to learn new things about computers, programming, logics, problem-solving, algorithms, graphics and of course gaming. I know C++ and C but only at base level as I can only use them to develop console applications. I make front end applications and am learning php I am learning JavaScript, CSS and Php

Updated on April 06, 2022

Comments

  • Ayush Mahajan
    Ayush Mahajan about 2 years

    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?

    • janos
      janos over 7 years
      Does the error message mention a lock file?
    • Ayush Mahajan
      Ayush Mahajan over 7 years
      @JeffPuckettII thanks but method I mentioned is working. And I learned it from youtube. Link is link If there is something wrong with the method, do you mind putting some light on the topic.
  • Ayush Mahajan
    Ayush Mahajan over 7 years
    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.
  • pixel
    pixel over 7 years
    It does not though. I can find index.lock file but deleting it does not change anything
  • RalfFriedl
    RalfFriedl almost 5 years
    There is already an accepted answer. What do you think should be changed in .gitignore, and why would it help?
  • Salih Kiraz
    Salih Kiraz almost 5 years
    whitespaces delete in .gitignore file
  • SPlatten
    SPlatten about 4 years
    In my case I had to use "rm -f ../.git/index.lock"
  • user_1856538_
    user_1856538_ over 3 years
    you just made my day !
  • Alberto Jaimes
    Alberto Jaimes about 3 years
    I would add to do it in the root folder, where .git is located