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: https://stackoverflow.com/questions/9459532/revert-to-pre-git-v1-7-8-git-submodule-behavior-with-submodule-filesystem-locati


I've learned initiated submodules are headless. Fix:

$ git submodule foreach git checkout master

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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