Search code examples
gitlabgit-submodules

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.


Solution

  • 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".