Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • fatal: Unable to create, git/index.lock': File exists

    • 0
    • 0
    • 0
    • 0
    • 3
    • 0
    • 1
    • 0
    • 42.6k
    Comment on it

    Hi Readers!

    Sometimes while trying a git commit, we get a message displayed as below

    fatal: Unable to create 'your_project_path/.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.

    What should be the resolution to get rid of this error:

    1. Open terminal & go to the path where your project is. 
    2. Type  ls  command and check if there is a .git folder. This is a hidden folder. Make sure you have enabled flag to see hidden files. If not check this blog - How to show hidden files and folders in Mac OS-X-Finder.
    3. Type  cd .git  it will enter into the .git directory. 
    4. Type  ls  command to check the files.
    5. You will see there is a file  index.lock 
    6. Type  rm -f index.lock  command to delete the file. This will delete the file. Make sure you have the ownership. Otherwise Type  sudo rm -f index.lock Enter password.
    7. Type  cd .. 
    8. Type  git commit  to commit again.

    Hope this will solve your problem. If you face any issue, please write your comments below. I will be happy to help you!

    fatal: Unable to create, git/index.lock': File exists

 3 Comment(s)

  • No, this is the index file. The index.lock file is generated when we try to commit or push and some error occurs due to which it never allows us to commit or push again. If you are not able to find that file, then everything is fine with your repository.

  • Hi thank you for this! I got the same error in SourceTree, I did everything you outlined, and I do not have an 'index.lock' file in my .git directory, but I do have an 'index' file. Is that the same thing?

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: