Unable to checkout git submodule path
When doing git submodule update
, git tries to checkout the commit/tree which is saved in the super project (in your example, the one with commit id dd208d4...
)
I think you get the error because within the submodule there no such object present. You have to make sure that it is there. Usually that means that you have to fetch/pull it from a remote first.
Probably you have to
git submodule foreach git fetch
git submodule update
or maybe
git fetch --recurse-submodules
Assuming, that the submodule is configured, so that it can fetch the missing commit from the remote origin
. In the end, you must know, from where you can fetch the missing commit and you have to get it.
You could check, whether you have dd208d4...
by doing something like:
cd ./module
git log dd208d46ecdd1ac0d2b2594a610fe4c9150fece1
git cat-file -p dd208d46ecdd1ac0d2b2594a610fe4c9150fece1
git ls-tree dd208d46ecdd1ac0d2b2594a610fe4c9150fece1
One possible cause for such a problem is, that the one who published the new commit from the super module, did not publish the necessary commits from the submodule. He has to publish the commits from the submodule first.
Make sure that the submodules were pushed
cd submodule-dir
git push
In my case, I had:
- committed to the submodule
- not pushed
- committed to the parent with the updated submodules
- pushed the parent
so it is no wonder that it could not be found.
Then, if you are using a web interface such as GitHub, you can also go to the submodule repository web page, and double check that the commit you need shows there.
push.recurseSubmodules on-demand
It is possible to automate pushes further with:
git push --recurse-submodules=on-demand
which also pushes submodules as needed, or starting with 2.7:
git config push.recurseSubmodules on-demand
git push
I had the same problem and I resolved adding a new commit for parent project and push all