How to include a folder from another repo in gitlab

Viewed 1132

Task: Access the files of a folder from repo A inside repo B.

I checked the include keyword in GitLab but that is used only for .yml files. I want to read the contents of a folder in repo B after it is imported from repo A.

Is there any way to do it using the .yml file?

1 Answers

I think the only way to include a folder of another git repository is using a git submodule. You can add a submodule with the command:

git submodule add -b <branch> git@<repo-B> path/where/to/add/repo-B

Then it's necessary to add the following variable in the job that requires the folder:

myjob:
  variables:
    GIT_SUBMODULE_STRATEGY: recursive
Related