致命:git-write-tree:构建树时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1356233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:48:50  来源:igfitidea点击:

fatal: git-write-tree: error building trees

gitgit-svncorruptionmsysgit

提问by Christoph Rüegg

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 fetchor git svn rebase, which I don't manage to get rid of:

我正在尝试使用 git-svn 将一个大型 subversion 存储库导入 git(这样我就可以在 git 中工作,但仍然不时地提交到 subversion)。导入 4000 多个修订后,我现在每次运行git svn fetch或时都会收到以下错误git svn rebase,我无法摆脱:

$ 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 --fulldoesn't report anything, neither does git fsck --unreachableor git fsck --no-reflog
  • git gc --aggressivedoesn't help
  • moving the single pack file away and reimporting it with git unpack-objectsdoesn't help
  • git svn reset -rXYwith XY a bit lower than the latest imported revsion doesn't seem to help either, neither does manually removing the latest entries from the reflogup 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).
  • git fsck --full不报告任何事情,也不报告git fsck --unreachablegit fsck --no-reflog
  • git gc --aggressive没有帮助
  • 将单个包文件移走并重新导入它git unpack-objects无济于事
  • git svn reset -rXYXY 略低于最新导入的修订版似乎也无济于事,手动删除最新条目也无济于事reflog
  • 重启。听起来很傻,但我在导入第一个 ~4000 修订版时确实观察到了一些奇怪的问题,好像有什么东西泄漏了很多内核资源(很可能在 Windows 子系统中),可能与 msys/mingw(或 avira 病毒扫描程序,我禁用测试)。

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

我也没有发现错误 128 真正代表什么。有任何想法吗?提前致谢!

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

可能与这个问题有关,该问题也与错误 128 有关,但有不同的错误消息,并且没有解决方案。

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

1.6.4.msysgit.0在 xp sp3 上使用 bash 的msysgit 版本

回答by user174710

git svn gc

git svn gc

(possibly git gcand git prunebefore)

(可能git gcgit prune之前)

回答by Levon Karayan

Short answer: Try resolving any merge conflicts, committing them, and they fetch/pull again.

简短回答:尝试解决任何合并冲突,提交它们,然后再次获取/拉取。

Longer explanation: I'm guessing you resolved this issue, since it was posted so long ago. I'm writing this since Google's ranking of StackOverflow articles is high enough that other people with this problem would be very likely to visit this page if they had this error.

更长的解释:我猜你已经解决了这个问题,因为它是很久以前发布的。我写这篇文章是因为谷歌对 StackOverflow 文章的排名足够高,其他有这个问题的人如果遇到这个错误,很可能会访问这个页面。

I encountered a similar error when trying to do a "git stash", what turned out to be the problem was that a merge conflict had occurred after a pull. I had not resolved & committed the conflict, and this left the repository in a state that prevented me from pulling/merging/etc...

我在尝试执行“git stash”时遇到了类似的错误,结果是问题是在拉取后发生了合并冲突。我没有解决并提交冲突,这使存储库处于阻止我拉/合并/等的状态...

If you make sure you don't have any blocking files, try again.

如果您确定没有任何阻止文件,请重试。

Good luck!

祝你好运!