Fixing an Empty Git Submodule Folder After a Clone

Written: Jan 2021

Here’s something I stumble over almost every time I clone a git repository with submodules.

Those darn folders are empty and using the project fails. Here are two ways to fix that:

Clone With The Recursive Flag

When issuing your git clone, add a --recursive flag. It will look like this:

$ git clone git@github.com:user/project.git --recursive

And as easy as that, your submodules are there.

If you cloned your repo and don’t mind starting over - delete the freshly cloned repository and add that --recursive to the command.

If you don’t want to start over…

Fix Those Submodules With An Init

You can fix your submodules in hindight, with this command:

$ git submodule update --init

This will fill in those missing pieces and you’ll be able to finally get back to interacting with your git project - submodules and all.

As I’m writing this, I’m considering to add --recursive by default when cloning something in the future. This way, I’ll never stumble over broken submodules again.

A word from the author

Hi, I'm Vladislav. I work with small teams and bootstrapped founders who need to get their infrastructure right — reliable deployments, less operational risk, and systems that don't fall apart the moment the founder looks away. If that sounds like your situation, here's how we can work together.

I've been writing about Docker, deployment, and infrastructure since 2017. If you'd like to read more, the articles page is a good place to start — or you can sign up for the newsletter to get new pieces by email.

© 2026 vsupalov.com. All rights reserved.