In gitlab, is it possible to create two or more repositories into only one project?

Emerson Oliveira picture Emerson Oliveira · Feb 9, 2015 · Viewed 31.9k times · Source

I'm running GitLab in a container of Docker but it's okay so far, no problem with that at all. I'm just in doubt about the creation of repositories in projects. I've created my first project in GitLab then after it creation i'd been redirected to a page with some commands to use in terminal. There were three sections, one of them were "Create a repository", i've used those commands and so i could create my repository of my project. However, after this, that page with commands went out and i could just see it again when i created a new project. After all,here goes my question again, is it possible to create two or more repositories into only one project?

Answer

DylanYoung picture DylanYoung · Feb 10, 2015

I only have time to give a short answer right now, but I hope it helps:

There is a one-to-one correspondence between repositories and projects (which would perhaps better be called repositories as well).

One Solution: Gitlab supports the creation of groups of projects/repos, which can be managed as a project consisting of multiple repos.


Git-based/local Options

If you are interested in git-based solutions to including a repository inside of another repository check out my answer here. If you use either the subtree merge method (at least a variant of it that tracks history) or subrepository method in this answer, your subprojects will appear in your master project in Gitlab, but the master project will also track changes in the subprojects.

Alternative Solution: Create a dummy repo that contains all of your desired repos as subrepos. This master repo will then track all subrepo changes. However; there are a few logistical issues, the .git files for the subrepos will not exist on Gitlab, so you might want a dedicated client with these files to pull the master repo from Gitlab (probably one commit at a time, if you want the subrepo histories to match the main repo history) and update the corresponding local subrepos (these could also be stored independently on GitLab).