Reputation: 49
When adding a submodule to my Gitlab repo, I install the main branch:
git submodule add -b main ../../some-project/my-repo.git
After that I use the gitlab runner with variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_SUBMODULE_UPDATE_FLAGS: "--remote --merge"
Everything works fine, but when you change the submodule branch in .gitmodules to another one, let's say "feature" (changed both manually in the file and with the command git submodule set-branch -b feature my-repo), then the pipeline drops with this: fatal: Needed a single revision
Unable to find current origin/feature revision in submodule path 'my-repo'
Locally, the command "git submodule update --init --remote --merge my-repo" works fine, updating the submodule to the latest commit in the "feature" branch
Upvotes: 2
Views: 1314
Reputation: 49
Found solution:
GIT_SUBMODULE_UPDATE_FLAGS: "--remote --checkout --no-single-branch"
Upvotes: 2