What does the git error message "Server does not allow request for unadvertised object" mean?
Solution 1:
jgit - What is git's advertised refs? - Stack Overflow:
During a fetch, the server can list references that it has and that the client may wish to fetch. These are the advertised references.
- It looks like you cannot directly get any single specific commit from the server, only refs (i.e. branches and tags). Or rather, that Github servers are configured to disallow such requests.
-
So, if you want to get a specific commit with
--depth
, it must be at most<depth>-1
commits away from the fetched ref (which is the branch/tag specified in the submodule's metadata)Typically, folks advise to just set
depth
to some number reasonably large but still much smaller than the total number of commit in the repo -- like50
or100
. E.g.50
is what Travis uses when doing the initial clone for the project.
If you aren't updating the submodule with --depth
, failing to find the commit would mean any of:
- the submodule's tree is in "shallow" state and the above applies (only possible when it was previously updated with
--depth
or its entry in.gitmodules
hasshallow = true
) - the commit is not on the branch that the submodule is using
- the commit is not in the submodule's repo at all:
- either someone made a mistake,
- or it was once there but was deleted by a forced push
For the record, in your specific case, it was the last case: commit 5bbcdc5df9d01b521e8da011bab0da70bdec3653
is not in the https://github.com/simsong/http-parser.git
repo at all.
Solution 2:
One way to get access to an unadvertized object is to sync. Then a submodule update should work, like:
git submodule sync --recursive
git submodule update