'How to add git submodule with nested submodules?

How to add a submodule with nested submodules?

When I do the following only the root submodule is added. How to add all submodules in the submodule recursively?

git submodule add https://the-submodule.git path/to/submodule

In the above submodule there is a nested submodule and the folder is not even created after cloning

path/to/submodule                   <- root submodule
path/to/submodule/nested-submodule  <- nested submodule (folder not even created)

The main project is on github and the submodule is gitlab (with including nested submodules)

git


Solution 1:[1]

After cloning you have to init recursively with

git submodule update --init --recursive

This will do what you want

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ôrel