113

I was just trying to commit changes to the Git master. From what I have read, it seems that the idea is to delete the lock file. The message says:

make sure no other Git processes are running and remove the file manually

Perhaps someone knows, which file to remove and how to remove?

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Pinchas K
  • 1,541
  • 3
  • 13
  • 19
  • 1
    Could you show the full error message including the command you're running? – Schwern Feb 07 '12 at 22:41
  • i use the tortoise though. can you delete that file in the tortoise or only in the shell? – Pinchas K Feb 07 '12 at 22:44
  • You'll probably have to do it in a shell or file explorer. You may have to show hidden files. – Schwern Feb 07 '12 at 22:45
  • full error is this: fatal: Unable to create 'C/etc/.git/index.lock' file exists. If no other git process is currently runnning, this probably means a git process crashed in the repository earlier. Make sure no other git process is running and remove the file manually to continue. – Pinchas K Feb 07 '12 at 22:46
  • 5
    The error message says it all. Delete `C:\etc\.git\index.lock` like any other file. – Schwern Feb 07 '12 at 22:49

9 Answers9

214

The file in question is likely .git/index.lock and it should be safe to just remove it if you have no other git processes running. Make sure a git-svn command isn't hanging.

PS My usual approach to fixing git-svn problems is to make a fresh pull of the repository. Time consuming, but you can do it in parallel with trying to fix the problem. Have a little race between you and git. Of course, this only works if you didn't have unpushed commits.

Schwern
  • 153,029
  • 25
  • 195
  • 336
83

Removing the index.lock file like Schwern stated will solve this problem.

You can remove it by running rm -f ./.git/index.lock

The rm command is used to remove (delete) files and directories.

The -f stands for force which tells your computer to remove the files without prompting for confirmation

Joel
  • 4,503
  • 1
  • 27
  • 41
9

For "GUI" user like me

Open Git Extension and choose repository (if more than one) Choose "Settings" from top menu then "Git Maintenance" and then click on "Delete Index Lock"

Git Extensions: Settings->Git Maintenance->Delete Index Lock

user3981082
  • 111
  • 1
  • 2
6

It may also concern any *.lock files in .git/

Check and remove them. You may use: rm -f ./.git/*.lock

artegen
  • 131
  • 1
  • 4
2

You have already opened a commit in another tab in the terminal

1

I solve this error by just following steps:-

  1. Go in your same directory in which your project exist.
  2. Unhide Hidden files (for ubntu press ctrl+ H)
  3. Move inside .git directory
  4. Remove "index.lock" file

It solve this Problem

Abhay Kumar Upadhyay
  • 2,117
  • 1
  • 7
  • 12
0

The answer giving by @Joel helped, except that for windows users you may have to enable show hidden files/folders to access .git folder where index.lock file exist. Use this link in case you don't know how to enable hidden folders.

Joyce obi
  • 59
  • 1
  • 11
0

Removing the index.lock file like Schwern stated will solve this problem.

You can remove it by running rm -f ./.git/index.lock

The rm command is used to remove (delete) files and directories.

The -f stands for force which tells your computer to remove the files without prompting for confirmation

still not working means open the git through git bash instead of doing in terminal

sarangan
  • 63
  • 5
0

I was facing the issue, and I couldn’t even able to find the index.lock. My environment was a little bit different, a cluster with multiple nodes. The issue was encountered in the master node, and I solve it just by jumping to the worker node since the master node is chaired by all connected user