Server does not allow request for unadvertised object
Asked Answered
N

2

5

I know this question has been asked before, but I found all answers to just give me a quick solution to the problem, or a confusing explanation of why it happens and how it is actually solved.

This is how i encountered this error. One of my teammates pushed a change to a submodule in our repo. After pulling from master git status showed new commits in our submodule:

modified: path/to/submodule/submodule_name (new commits)

So i decided to update the submodule by running

git submodule update path/to/submodule/submodule_name -- here is the doc for this command

at this point i got the error

Fetched in submodule path 'path/to/submodule/submodule_name', but it did not contain ... Direct fetching of that commit failed

After googling i found different answers to my problem:

  1. github
  2. superuser
  3. stackoverflow

superuser is the link that got me closer to understanding the issue, and github just handed me the command to run to fix it -- git submodule sync

Now, i am still a bit confused on how the change showed up in my git status yet when i try to update the server is not aware of the commit. And what does git submodule sync do to make that commit available ?

Northerner answered 24/9, 2019 at 21:46 Comment(0)
P
7

You error message does mention:

dit did not contain ... Direct fetching of that commit failed

That is typical of a commit done in the submodule original cloned repository... not pushed back to its remote repo.
But the new state of the submodule repo was recorded in the parent repo, which was pushed.

Which means:

The parent repo reference a commit of the submodule repo which was never pushed to the submodule remote URL: an update from a clone would:

  • update the submodule reference
  • try and update the submodule content with that reference but fails.

Your teammate did push a parent repo change (specifically a new state of the submodule) but did not push the commit(s) done within that submodule.

Polky answered 25/9, 2019 at 4:59 Comment(0)
D
3

It looks like you need to sync the submodules recursively. Try this:

git submodule sync --recursive
Dactylo answered 22/4, 2020 at 10:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.