Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server does not allow request for unadvertised object

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 ?

like image 609
Nicola Pedretti Avatar asked Mar 04 '23 09:03

Nicola Pedretti


1 Answers

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.

like image 93
VonC Avatar answered Apr 12 '23 23:04

VonC