← Back to all fixes
Git

Submodule directory is empty after git clone

The Issue

You cloned a repo. A folder like `vendor/somelib` exists but is empty. Code fails to build.

Root Cause

Git submodules are not automatically cloned. You need an extra step to fetch their content.

How to Fix
  1. Initialize and fetch submodules: `git submodule update --init --recursive`
  2. Or clone with submodules from the start: `git clone --recurse-submodules <url>`
  3. To update submodules to their latest commit: `git submodule update --remote`
  4. Check registered submodules: `cat .gitmodules`