Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can’t get submodules to work in gitlab

I have a project in my computer with the following structure:

.
├── bin
├── code
│ └── src
├── data
├── doc
├── experiments
└── reports
└── summary

code/src and /reports/summary are submodules defined in .gitmodules

[submodule "code/src"]
path = code/src
url = ./code/src/

[submodule "reports/summary"]
path = reports/summary
url = /home/zunbeltz/Proyectos/reports/base/

I created a project in the gitlab of my workplace (version 7.9.4). After adding the new origin and git push -u origin master The links of the submodules are broken with a 500 error code.

I tried also in gitlab.com, (version 7.14) and I get a 404 error

Does someone know what is going here?

Note: I did post this message on the gitlab forum, but have any answer.

like image 539
zunbeltz Avatar asked Sep 15 '15 06:09

zunbeltz


People also ask

Does git pull include submodules?

Pulling with submodules. Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the --recurse-submodules and the --remote parameter in the git pull command .

How do I merge submodules into repository?

Merging the submodule In the main repository run the commands: git remote add models-origin [email protected]/exampleUser/models. git fetch models-origin. git merge --allow-unrelated-histories models-origin/master.

How do I clone a git repository with submodules?

The list of steps required to clone a Git repository with submodules is: Issue a git clone command on the parent repository. Issue a git submodule init command. Issue a git submodule update command.

Should git submodules be in Gitignore?

Show activity on this post. No, you don't need to add your submodule to your . gitignore : what the parent will see from your submodule is a gitlink (a special entry, mode 160000 ). That means: any change directly made in a submodule needs to be followed by a commit in the parent directory.


1 Answers

The idea of submodule is to reference nested git repo with an url that you can access.

./code/src/ and /home/zunbeltz/Proyectos/reports/base/ are file-based url that you can access locally.
But once pushed on Gitlab, said Gitlab wouldn't know how to interpreted/access those urls.
Hence the broken links.

As mentioned in the discussion:

On Gitlab, you would have to have 3 repos:

  • one for the parent repo
  • one for each submodules

In the parent repo on GitLab, you would see the same structure as on the local parent repo except GitLab would use a special icon to represent that folder.
That would represent a gitlink, a special entry in the index of a repo.

Ivan mentions in the comments the now (2018, three years later) official documentation "Using Git submodules with GitLab CI".

like image 68
VonC Avatar answered Sep 21 '22 07:09

VonC