Git Unpack Error Over HTTP Fetch

Had a problem today with a server fetching the latest changes from our upstream repository over HTTP.


git fetch origin
error: packfile .git/objects/pack/pack-385ce85680e3c3ff129907559101b9a4544a9da0.pack does not match index
error: packfile .git/objects/pack/pack-385ce85680e3c3ff129907559101b9a4544a9da0.pack cannot be accessed


I didn't have much luck finding any advice on google, so I thought I'd post my own solution, which was extremely simple!


rm  .git/objects/pack/pack-385ce85680e3c3ff129907559101b9a4544a9da0.pack
git gc
git fetch origin

Getting pack 385ce85680e3c3ff129907559101b9a4544a9da0
which contains dcbe1aa3d3e564aea30acc55a7df105bfdc586a2
# success

Essentially, in the version of git we run (1.6.3.1), git fetch over HTTP will blindly pull down every pack regardless of whether or not it is applicable to the downstream checkout. What was happening was the pack somehow got corrupted and an unfetched pack was dependent on that corrupted pack, so git couldn't resolve the mismatch. Removing the corrupted pack let git re-fetch it and the dependent pack that followed.

Comments

Gaurav said…
Thanks! This helped me today

Recent posts