Question

When I try to commit changes to local repo, I have got following message:
fatal: unable to write new_index file

Was it helpful?

Solution

As this thread illustrates, this is usually a disk space issue:

$ git status
fatal: unable to write new_index file

One cause of this that I found was that my file system had run out of space.
Finding large directories with something like the following helped clean up some log files that had run wild :

$ du -h / | grep ^[0-9.]*G

Note: you can also see it for

Problem still remained so I ran File Monitor from Sysinternals Suite.
It seems that Eclipse is accessing index file constantly and blocks command line git

Yeah, looks like Windows Defender strikes again. I always forget to disable that damn thing. I can't believe how broken it is. Destroys Blu-ray playback at home, breaks Git at work...

OTHER TIPS

If you are using TortoiseGit, this error (or more recently: error: Unable to write index.) is very likely caused by having TortoiseGit icon overlays enabled. To disable icon overlays, go to:

TortoiseGit > Settings > Icon Overlays

and set Status cache to None. This may be fixed in a future version of TortoiseGit, but for now it seems to be common.

I was getting the same error while I was merging a git repo that was sshfs mounted. There was no shortage of space anywhere.

In my case the solution was to add an -o workaround=rename option to the sshfs mount command.

Like so: sshfs -o idmap=user -o uid=[lokal uid] -o gid=[lokal gid] -o workaround=rename [host]: [mountpoint]

I have found solution. Just need to free some disk space.

I have followed every solution here and none of them worked. I have no shortage of disk space, I have disabled Windows Defender, disabled icon overlays and whatnot. I had tons of files to import and maybe this was causing the problem (I had boost libraries among other things).

I simply opened "Git Bash" and issued a number of git add and a git commit and all went well. This has something to do with TortoiseGit but I am not sure what. It seems to choke on a large number of files or large directory depth.

I got this error using Cygwin and git-svn. The solution that worked for me was to do garbage collection (odd as it seemed at the time):

$ git gc

I had same problem. In my case above solutions didn't work.

The reason behind this error is that the file .git/index was corrupted for some unknown reason. I just renamed the file to something else and run the 'git add .' command from git bash and it worked.

Hope this helps someone.

I was having this issue, but I was able to commit with msysgit. I updated tortoisegit, and also noticed that my msysgit version was not in sync with tortoise git. I'm not sure if the latest version fixed it, or if it was due to having different versions of tortoise and msysgit. Anyway, another thing to check. It all started working after updating them both to TortoiseGit 1.7.10.0 git version 1.7.10.msysgit.1

I used Unlocker on .git\index.lock to unlock any handles that are held open by other processes. In my case it was TGitCache.exe.

For me it was a file locking issue.

To solve it I:

  1. Copied the index file (located in the hidden ".git" folder)
  2. Deleted the original
  3. Renamed the copy back to 'index'

Hope this helps!

I had the same problem on macOS, I have solved it by removing repo_folder/.git/index.lock

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top