5

My colleague tried to do a git pull from our master. He got this error:

$ git pull
fatal: loose object f7630cc30248df1e19bcb40c9de1b60b71cdfce1 (stored in ./objects/f7/630cc30248df1e19bcb40c9de1b60b71cdfce1) is corrupt
fatal: The remote end hung up unexpectedly

Luckily, my repo seems not to be corrupt, and I do have a copy of f7630cc30248df1e19bcb40c9de1b60b71cdfce1. But I can't figure out what he needs to do with it. We tried just taking my copy & putting it in his .git/objects/f7/ directory, but the error message stays the same.

Is it supposed to be as simple as just shuffling files around, or do we need to do something else?

Ken Williams
  • 22,756
  • 10
  • 85
  • 147
  • This question has better answers in https://stackoverflow.com/questions/11706215/how-can-i-fix-the-git-error-object-file-is-empty/31110176, maybe it should be flagged as duplicate. – abaumg Nov 04 '21 at 09:13

2 Answers2

4

Does that file exist loose on the master? If so, is it valid or corrupt there? Yes, it should be sufficient just to copy a good version of the file into the objects directory.

araqnid
  • 127,052
  • 24
  • 157
  • 134
  • It's there on the master, but I'm not sure how to tell whether it's loose, how can I do that? – Ken Williams Dec 08 '11 at 23:39
  • if it's present in `.git/objects/f7/`, that's what "loose" means (i.e. not "packed" into `.git/objects/pack`) – araqnid Dec 08 '11 at 23:47
  • Oh! Okay, great - when he's back tomorrow, we'll try copying it directly. I'm guessing some cygwin->Windows->server->colleague->copy->paste step corrupted my copy of the file. – Ken Williams Dec 08 '11 at 23:51
  • 1
    As it turns out, the problem wasn't corrupt file contents, it was too-restrictive file permissions on the repository. We're just using a file server as our repository, which sucks. We need to switch to a server. – Ken Williams Dec 09 '11 at 15:01
1

Check the .git/objects directory for files not readable by you. I had this problem and that was the issue. A coworker had cloned my repo while the central server was down, and (I think) a push ended up putting files owned by him but not readable by me.

msouth
  • 832
  • 11
  • 21