Git & Version Control #213134
🏷️ Discussion TypeQuestion 💬 Feature/Topic AreaCode Search and Navigation BodyWhen running git submodule update --init --depth 1 on a fresh shallow clone, Git throws error: Server does not allow request for unadvertised object for one specific pinned commit. |
Replies: 2 comments 1 reply
Why This HappensThis happens because GitHub's Git servers do not enable When you run
How to Fix ItDepending on your workflow or CI environment, you can resolve this in one of the following ways: 1. Omit
|
|
This happens because --depth 1 limits the amount of commit history Git fetches, but the submodule is pinned to a specific commit SHA that may not be included in the shallow history. Even if the commit exists on the submodule’s main branch, GitHub may reject a direct fetch by SHA if the commit is not advertised through an available reference. You can try the following solutions:
Regarding uploadpack.allowReachableSHA1InWant, this is a server-side Git configuration. On GitHub-hosted repositories, you generally cannot change this setting yourself. The important distinction is that shallow clones are supported, but fetching an arbitrary pinned commit that is not available through an advertised reference can fail. |
Why This Happens
This happens because GitHub's Git servers do not enable
uploadpack.allowReachableSHA1InWantoruploadpack.allowAnySHA1InWanton public or private repositories. Instead, GitHub only enablesuploadpack.allowTipSHA1InWant(along with Git protocol v2 ref advertisements).When you run
git submodule update --init --depth 1:--depth=1) by passing the exact pinned commit SHA directly to the remote server.mainthat isn't explicitly advertised as a ref), GitHub'sgit-upload-packrejects the direct SHA request with: