Here\'s part of the contents of my .gitmodules file:
[submodule \"src/static_management\"]
path = src/static_management
url = gi
This means the submodules haven’t been set up correctly and a git submodule add command will have to be executed.
IF SUBMODULES WERE ADDED CORRECTLY
To give some background, when a repo with submodules has been set up correctly someone has already performed a git submodule add command, which does the following things:
Point 3 and 6 are relevant when you clone the superproject, and point 6 indicates whether a git submodule add has been performed correctly and was committed.
You can check point 6 by seeing whether the folders in which the submodules should reside are already there and empty (Note: this does not require a .keep or .gitignore mechanism to be in place, since this is part of a Git mechanism.) After cloning the superproject you can also perform a git submodule to see which submodules are expected.
You can then proceed by doing:
git submodule
will show the submodules present in the tree and their corresponding commit hash code, can serve as an initial check to see which submodules are expected
git submodule init
copies the submodules parameters from the repo’s .gitmodules file to your private .git/config file (point 4)
git submodule update
clones the submodules to a commit determined by the superproject and creates the submodules' .git folders under your superproject's .git/modules/ folder (points 2 and 5)
git submodule update --remote
same as update but sets the submodule to the latest commit on the branch available by the remote repo, similar as going in each submodule’s folder afterwards and do a git pull
or:
git submodule update --init --remote
which is all of the above combined.
Alternatively, when the repo is set up correctly, you can also do a git clone with the --recursive flag to include the submodules with the init and update performed on them automatically.
IF SUBMODULES WERE NOT ADDED CORRECTLY
But if the submodules are not committed correctly, and the submodules and their corresponding folders are not already recorded in the index, then first every submodule in the .gitmodules file needs to be individually added via git submodule add before one can proceed.