git fetch fails with "fatal: git upload-pack: not our ref a639..." and succeeds the second time
Asked Answered
A

0

6

We have a git repository that includes various submodules. There is an old clone of the main repo, on which we reproducibly get the following error when running git fetch:

fatal: remote error: upload-pack: not our ref a63912a948cf1ce4c700c16b3417e89287f61f63
fatal: git upload-pack: not our ref a63912a948cf1ce4c700c16b3417e89287f61f63

When running git fetch a second time after this, the error disappears.

My current assumption is that the old clone (or some branch being fetched) contains references to commits in submodules which for whatever reasons (rebases?) have disappeared from origin. I understand that this can happen but how can I find the specific dangling reference, so that I can fix it?

The old clone sits in a base image that we use for setting up tests, so I can perfectly reproduce the error even if it is gone on each second attempt. However, I am reluctant to just ignore the problem by littering our scripts with git fetch || git fetch or similar hacks.

So how can I find out which commit in the main repo references the missing ref a63912... More generally, is there a way to perform an integrity check on a repo that can catch these errors upfront?

Awlwort answered 15/10, 2020 at 9:49 Comment(3)
Alex, did you figure this out? I've hit the same problem. In my case the cause is that a fetched branch temporarily pointed a submodule at a commit that never got pushed to the submodule's repository. A workaround seems to be to first fetch with --no-recurse-submodules and then with --recurse-submodules, though that's barely better than just trying twice. I believe the reason the fetch succeeds the second time is that the fetch of the parent repo actually completed, so upon rerun it doesn't encounter the invalid ref. If that is indeed what's happening, it's certainly confusing.Hoopen
Hi @Alex - did you have any success in figuring this out? I'm hitting the same wall...Subtend
I had this same problem, but was not caused by submodules. It was caused by an new text file being unexpectedly 700mb. Deleted that one text file and this error went away.Feune

© 2022 - 2024 — McMap. All rights reserved.