7

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?

2
  • 1
    Is /cygdrive/u a network share? – cmcginty Jul 28 '11 at 23:44
  • @Casey U: is a network drive. After some experimentation last night, turns out that git works fine on my local C: drive. It used to work fine on U:, but the IT guys must've changed something with permissions or the implementation without my knowledge because now git is not able to create a master branch, which seems to be the root cause. Off to the C: drive I go! It was probably a dumb idea to use a network drive :(. If somebody wants to post this as the answer, I'll select it (not sure if I'm supposed to answer my own question since I don't know EXACTLY why it fails). – Weston Jul 29 '11 at 15:19
0

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.

1
9

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:

git config --add "core.createobject" rename

(My setup is Cygwin git, working on a .git directory over samba)

4
  • Yes, this did the trick. From "it doesn't work at all and failure all around" to "it works". Thanks a lot! – three Jan 14 '15 at 21:55
  • Brilliant! This works perfectly for me for a slightly different issue (error: failed to read delta-pack base object ...) caused by cygwin git on SMB – Josh Bode Mar 13 '15 at 18:55
  • This just helped with latest cygwin (2.0.2) as well. It used to work just fine without this setting. Not sure if it broke in cygwin or on our end. – mplwork May 28 '15 at 16:37
  • Hate to add a +1, but this also solved the issue for me. Cygwin git 1.7.9 running on Windows 7 x64 and the repo on a Windows share. As with others, having the repo stored on a local drive worked fine. – mjturner Jun 23 '15 at 10:18
2

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.

3
  • "why put up with the annoyances and outright brokenness that comes with Cygwin Git?" Because of all the other advantages that come with using a real Linux shell in Cygwin. Plus there are a few things that don't work right in msysgit, like HEAD^. That said, I do agree with you that msysgit just works and is a good choice. – MatrixFrog Jul 29 '11 at 17:36
  • @MatrixFrog: Nobody said to get rid of Cygwin, just to get rid of the git that comes with Cygwin, and use the regular Windows git instead. Windows binaries work just fine from the Cygwin bash prompt. No need to throw out the baby with the dirty bathwater. – Michael Dillon Aug 7 '11 at 6:02
  • @Michael Exactly. That's what I meant. – MatrixFrog Aug 7 '11 at 21:52
2

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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.