Nested Git submodules not cloning properly with –recursive flag
I’m setting up an internal mirror of a github project. The project has submodules in it, which also have submodules within the original submodules.
I’ve mirrored all of the repositories individually, and have updated the .gitmodules files in all of the repositories to point to the internal mirror locations. All of the repositories clone individually with –recursive without any issues. For some reason, when I try to clone any repository that has nested submodules, the first set of submodules is read correctly from .gitmodules and cloned, but then the submodules within that submodule will all try to clone from their original github URLs. I can’t figure out where these URLs are coming from, because the nested submodules have all had their .gitmodules files updated.
- Git submodules, shared code and XCode
- How to “git clone” including submodules which are not reachable from client host?
- Git Should Not Checkin If Submodule Has Modified Files
- Git submodule with unique local file in the submodule
- Project dependent on other project from multiple sources
- What is the current way to remove a git submodule?
Has anyone ran into this before? Any ideas?
2 Solutions collect form web for “Nested Git submodules not cloning properly with –recursive flag”
When you’re doing initial setup with
git submodule update --init --recursive you’re taking the
.gitmodules values straight from the recorded commits. I’m thinking when you updated the
.gitmodules files you didn’t do it depth-first, so while the
.gitmodules recorded in the first-level submodule was updated and added, its own submodules hadn’t yet been updated and added so the recorded commit still had the original
This is the best way to do this:
git submodule update --init --recursive
Does this solve your problem?