Windows (Cygwin) 上的 Git 提交已损坏。
我在 Windows 7 上安装了 Cygwin。Git 一直工作得很好,直到几天前,提交才停止工作。这是一个全新的存储库的日志:
wt@CO /cygdrive/u/Projects
$ mkdir Temp
wt@CO /cygdrive/u/Projects
$ cd Temp/
wt@CO /cygdrive/u/Projects/Temp
$ touch Hello.txt
wt@CO /cygdrive/u/Projects/Temp
$ git init
Initialized empty Git repository in /cygdrive/u/Projects/Temp/.git/
wt@CO /cygdrive/u/Projects/Temp
$ git add .
wt@CO /cygdrive/u/Projects/Temp
$ git commit -m "hi"
error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'Hello
.txt'
error: Error building trees
我已经用谷歌搜索了它,但没有成功。这是怎么回事?
I've got a Cygwin install on Windows 7. Git was working great up until a few days ago, when commits just stopped working. Here's a log of a brand new repo:
wt@CO /cygdrive/u/Projects
$ mkdir Temp
wt@CO /cygdrive/u/Projects
$ cd Temp/
wt@CO /cygdrive/u/Projects/Temp
$ touch Hello.txt
wt@CO /cygdrive/u/Projects/Temp
$ git init
Initialized empty Git repository in /cygdrive/u/Projects/Temp/.git/
wt@CO /cygdrive/u/Projects/Temp
$ git add .
wt@CO /cygdrive/u/Projects/Temp
$ git commit -m "hi"
error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'Hello
.txt'
error: Error building trees
I've Google-ed the hell out of it to no avail. What's going on here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Cygwin git 似乎正在使用“create-temp-file-then-hardlink-to-destination”方法创建新的目标文件。我认为硬链接对于 cygwin 来说是令人困惑的!
底线:使用以下方法解决:(
我的设置是 Cygwin git,通过 samba 在 .git 目录上工作)
Cygwin git appears to be creating new object files using a "create-temp-file-then-hardlink-to-destination" method. I think the hard-linking is confusing for cygwin!
Bottom line: solved using:
(My setup is Cygwin git, working on a .git directory over samba)
请改用 Windows 版 Git。 Cygwin 的 Git 不久前开始走下坡路。随着时间的推移,我和我的团队遇到了越来越多的问题,最后只是切换了。有了 Git 到 Windows 的完整移植(msysgit/Git for Windows 项目)可用,为什么要忍受 Cygwin Git 带来的烦恼和彻底的破坏呢?自从切换以来我们没有遇到任何问题。
Use Git for Windows instead. Cygwin's Git started going downhill a while back. My team and I had more and more problems with it as time went on and finally just switched. With a full port of Git to Windows (the msysgit/Git for Windows project) available, why put up with the annoyances and outright brokenness that comes with Cygwin Git? We haven't had a single issue since switching.
这里的问题是,Git 创建对象文件的默认方法在 Windows 共享驱动器上不起作用,并且(与 Windows 的 Git 或 msysgit 不同),Cygwin 的 Git 一直在使用该默认方法。
直到今天——我是 Cygwin 的 Git 维护者——我刚刚重建了它,以使用在共享驱动器上工作的不同方法(它还有其他缺点,但我们对此无能为力)。如果您再次运行 Cygwin 的
setup-x86[_64].exe
并下载最新版本的 Git(v2.4.5-3 或更高版本),您应该会发现一切都恢复正常了。(新的 Git 版本刚刚上传,所以可能需要一点时间才能到达所有镜像,但我认为最多 24 小时,许多镜像都比这更快。)
The problem here is that Git's default method of creating object files just plain doesn't work on Windows shared drives, and (unlike Git for Windows or msysgit), Cygwin's Git has just been using that default.
Until today – I'm the Git maintainer for Cygwin – and I've just rebuilt it to use a different method that does work on shared drives (it has other disadvantages, but there's not a lot we can do about that). If you run Cygwin's
setup-x86[_64].exe
again and download the latest version of Git (v2.4.5-3 or later), you should find everything works again.(The new Git build has only just been uploaded, so it may take a little while to reach all the mirrors, but I think that's at most 24 hours, and many mirrors are quicker than that.)
问题表明回购正在工作,但它们神秘地崩溃了。该错误似乎表明内部 git 树对象存在文件系统读取问题。查看
/cygdrive/u
,表明这可能是映射的网络驱动器。尝试在本地驱动器上运行 git 以确认网络共享正常工作。
不幸的是,我没有任何确切的信息导致失败。您的网络共享可能不支持 git 期望可用的文件系统功能。
The question stated that the repo was working, but them mysteriously broke. The error seems to indicate a file system read issue with the internal git tree objects. Looking at
/cygdrive/u
, indicates that this is likely a mapped network drive.Try and run git on a local drive to confirm the network share is working correctly.
Unfortunately, I don't have any exact information what would be causing the failure. It is possible that your network share does not support the file system features that git is expecting to be available.