How do I create nested repositories in GitHub?

后端 未结 2 1582
难免孤独
难免孤独 2021-02-01 19:09

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

2条回答
  •  深忆病人
    2021-02-01 19:32

    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.

提交回复
热议问题