fatal: git-write-tree: error building trees

Christoph Rüegg picture Christoph Rüegg · Aug 31, 2009 · Viewed 13.5k times · Source

I'm trying to import a large subversion repository into git using git-svn (so that I can work in git but still dcommit to subversion from time to time). After importing more than 4000 revisions I'm now getting the following error whenever I run git svn fetch or git svn rebase, which I don't manage to get rid of:

$ git svn fetch
error: invalid object 100644 1f2....742 for 'src/path/.../file.cs'
fatal: git-write-tree: error building trees
write-tree: command returned error: 128

What I've tried so far:

  • git fsck --full doesn't report anything, neither does git fsck --unreachable or git fsck --no-reflog
  • git gc --aggressive doesn't help
  • moving the single pack file away and reimporting it with git unpack-objects doesn't help
  • git svn reset -rXY with XY a bit lower than the latest imported revsion doesn't seem to help either, neither does manually removing the latest entries from the reflog up to XY.
  • reboot. Sounds silly, but I did observe some weird issues while importing the first ~4000 revision, as if something was leaking a lot of kernel resources (most likely in windows subsystem), might be related to msys/mingw (or the avira virus scanner, which I disabled for testing).

I also didn't find out what error 128 really stands for. Any ideas? Thanks in advance!

Might be related to this question which is about error 128 as well but with different error messages, and without a solution.

msysgit version 1.6.4.msysgit.0 with bash on xp sp3

Answer

user174710 picture user174710 · Sep 17, 2009

git svn gc

(possibly git gc and git prune before)