Why is the submodule folder empty after cloning, and how do you fix it?
A normal clone does not download submodule contents. Run git submodule update --init --recursive, or clone with git clone --recurse-submodules next time.
Explain it simply
Cloning copies the parent and its pointers, but the pointed-to books are not fetched until you ask.
The empty folder is the placeholder. git submodule update --init registers and checks out the pinned commit of each submodule. Add --recursive if submodules contain their own submodules. To skip this in future, git clone --recurse-submodules URL does everything. CI systems often need this flag explicitly, otherwise builds fail with missing files.
Example
git clone https://github.com/team/app.git
cd app && ls libs/ui-kit # empty
git submodule update --init --recursive
# or: git clone --recurse-submodules https://github.com/team/app.gitWhat to say in the interview
"A plain clone does not fetch submodule contents. I run git submodule update --init --recursive, or clone with --recurse-submodules. In CI I enable the submodule fetch option so builds find the files."
Common mistakes
- Forgetting submodules in CI configuration.