简体   繁体   中英

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.

在此处输入图像描述

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-thin 1 from doing its job. How to work around that, I have no idea (I avoid Windows).


1 This 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.

How is the remote repo hosted and accessed ?

I would look into the owner and access flags of the objects/pack directory on the remote server, and possibly the flags on the pack-1263... pack file.


Suppose some action was taken on the remote server using the wrong credentials (eg : sudo git gc , or some action run as Administrator) and that this action created said directory or file, then this item would owned by root/admin and not be editable by a regular user.

I recently overcame this problem on a Windows pushing to a GIT repo that lives in a shared directory.

I navigated to where repo lived and found the objects/pack directory. The exact.idx.pack files had already been created by me but some hiccup must have happened.

After I renamed them, I did another git push and it was successful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM