GIT: “fatal: unable to write new_index file” while

2019-03-22 19:49发布

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

11条回答
走好不送
2楼-- · 2019-03-22 19:54

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.

查看更多
smile是对你的礼貌
3楼-- · 2019-03-22 19:54

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.

查看更多
疯言疯语
4楼-- · 2019-03-22 19:55

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
5楼-- · 2019-03-22 20:00

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

查看更多
虎瘦雄心在
6楼-- · 2019-03-22 20:03

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]

查看更多
贪生不怕死
7楼-- · 2019-03-22 20:04

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

查看更多
登录 后发表回答