Using Git submodules in CI jobs

Summary

Git submodules dont work in CI jobs

Steps to reproduce

  • Create a file .gitmodules
    [submodule "database_schema"]
      path = database_schema
      url = ../../nss/database_schema.git
  • My .gitlab-ci.yml
variables:
  GIT_SUBMODULE_STRATEGY: recursive

rspec:
  stage: test
  before_script:
    - ls
    - cd database_schema

What is the current bug behavior?

I cant acces to my submodule repo inside CI job.

$ cd database_schema
/bin/bash: line 63: cd: database_schema: No such file or directory

But i can see the line Upating/initializing submodules recursively. in my job

Fetching changes...
Checking out e5ed3c03 as master...
Updating/initializing submodules recursively...
Checking cache for master...
Successfully extracted cache
Edited Jun 26, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading