git push error – unable to write pack file


I have a colleague who is getting an error when he tries to push to a remote git repo.

git complains that it can’t write to a particular pack file on the remote repo. See screenshot below.

I’ve already checked into the obvious basic file permissions and such. Yes, he has read/write access. Yes, he’s using the right account. Etc.

I have a less than rudimentary understanding of what goes on under the hood with git, but my understanding of pack objects is that they are basically compressed-and-diffed versions of the individual file objects that were once contained in the "objects/??" directories. When performing a git push, git will create a pack file of the objects before sending them to the remote repo to reduce network traffic.

So it would seem to me that a pack file, once created, should never be modified. Is that correct? If re-packing is required to represent new information, wouldn’t git just create a new pack file with a new name? So then I’m confused as to why git is trying to write to an existing pack file.

Perhaps my understanding is wrong, but I’d someone to confirm or deny my position and perhaps explain a little bit.

enter image description here


So it would seem to me that a pack file, once created, should never be modified. Is that correct?

Generally, yes. However, when git push sends a thin pack to some other repository, the receiving Git has to "fatten" the thin pack. That requires write permission. Nothing should be using the thin pack at fattening time, so the write should be allowed.

Since you’re on Windows, the obvious candidate that might be causing this problem is some kind of security (anti-virus etc) scanner that opens the file and prevents Git from modifying it, preventing git index-pack --fix-thin1 from doing its job. How to work around that, I have no idea (I avoid Windows).

1This is what prints the Resolving deltas message. You can see how many objects it had to add to the thin pack, just above the error message.

Answered By – torek

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published