Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a project I want to clone:

$ git clone repo1 repo2

Everything copies over. Then I initiate submodules:

$ git submodule update --init --recursive

It downloads and populates the folders for all the submodules. I move into a directory of a submodule, and it's not a proper repo anymore.

I look closely at the submodule files and the .git folder has instead been turned into a file. This means I can't do development work on the submodules in the newly cloned project.

How do I get the clone to replicate the submodules, as git repos themselves, per the original project?

EDIT: May this have something to do with cloning from a relative path on the same machine? Perhaps an absolute path changes the manner of the clone?

This thread is exactly the same issue I'm having, but I just don't see the proposed solution as being the ideal answer:

share|improve this question

I've learned initiated submodules are headless. Fix:

$ git submodule foreach git checkout master

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.