I am able to create a repository via https://github.com/ (say repo
) and have:
https://github.com/username/repo.git
How do I create another repository (say sub_repo
) placed under repo
and expectedly have:
https://github.com/username/repo/sub_repo.git
Git allows you to include other Git repositories called submodules into a repository. This allows you to track changes in several repositories via a central one. Submodules are Git repositories nested inside a parent Git repository at a specific path in the parent repository's working directory.
GitHub does not allow nested repositories (IIRC Git doesn't allow this for bare repositories). However, you can use submodules to nest repositories on the "client side" in the working tree. You need to clone the parent directory.
On GitHub itself, you cannot group your repos by "folder", unless you create organizations. See SublimeText, for instance, as a group of all sublimeText packages repos. But that won't support a nested folder organization. For now (June 2017), that only supports a nested team organization structure.
GitHub does not allow nested repositories (IIRC Git doesn't allow this for bare repositories).
However, you can use submodules to nest repositories on the "client side" in the working tree.
You need to clone the parent directory.
Then, add the sub-repository as a submodule:
git submodule add https://github.com/username/sub_repo.git
The sub_repo module will then be linked to the parent repo and can be found in the sub_repo directory.
Commit (.gitmodules and sub_repo), push and you're done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With