Interview Q&A / Git & GitHub

BeginnerQuick answer1 min readUpdated 3 Oct 2026

Why is the submodule folder empty after cloning, and how do you fix it?

SHORT ANSWER

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

bash
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.git

What 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.

#git#submodules#clone

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.