Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 280
Emerson Oliveira Avatar asked Feb 09 '15 18:02

Emerson Oliveira


People also ask

Can a GitLab project have multiple repositories?

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

Can I have multiple Git repositories?

With Git, using multiple repositories is the only way to work efficiently. This enables each team to work independently, and do their work faster. You can also make sure that developers only have access to the repositories they need access to (thus making Git more secure.)


1 Answers

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

  • In short: NO
  • But also: YES, after a fashion

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).

like image 194
DylanYoung Avatar answered Oct 07 '22 12:10

DylanYoung