Have one repository in Gitlab like this folder tree:
somerepo
├─ innerrepo1
└─ innerrepo2
somerepo is the main repository. The others are sub-directories. Is it possible to clone innerrepo1 inside innerrepo2? If yes, how to do it?
I have no idea how to get it. The hidden .git folder is inside somerepo.
CodePudding user response:
Try to add it as a submodule:
git submodule [--quiet] add [<options>] [--] <repository> [<path>]
Example (using master branch and dummy GitHub links):
git submodule add master --name innerrepo1 https://github.com/bla_bla_bla/innerrepo1.git innerrepo2/innerrepo1
This will add the following entry in the file: "/somerepo/.gitmodules":
[submodule "innerrepo1"]
path = innerrepo2/innerrepo1
url = https://github.com/bla_bla_bla/innerrepo1.git
For more info see: Git-Tools-Submodules and git-submodule.