I m facing a weird problem with submodules in a bare repo. I illustrate what I did.
I have a repo which contains 4 modules. It looks like this-
*Superepo (top level repo)- I added following submodules to this repo:
mod_1,mod_2,mod_3 and mod_4 (internal submodules).
After that I created a bare repo from this Superepo and call it superepo.git
Now I use this bare repo to share stuff across different ppl.
I cloned the bare repo along with all the sub-modules in a directory called ~/clone. (git clone –recursive ~/Superepo.git clone).
I modified something in one of the cloned submodules (mod_1 and mod_2). I committed these changes to respective submodules. I also committed changes to the superepo “clone”. (~/clone)
Then I pushed the changes to the bare superepo using “git push ~/superepo” which went through.
Now someone else tried to clone the bare repo. However, he gets an error as follows–>
fatal: reference is not a tree xyz (xyz = sh1 of mod_1 commit)
Unable to checkout xyz in submodule path mod_1.
I am kind of clueless what I could have done wrong. Am I doing something wrong with either bare repo or supermodules?
You should push the changes that you did in the submodule to the submodule’s original repo. As of now you made updates in the submodule and updated the enclosing repo to look at that update, but for a new clone, it will have no idea of that update because you haven’t pushed it to the submodule repo which is what will be seen when you clone.