Gitlab-CI on local machine can't clone submodules

I’m trying to execute the CI task locally on my machine but it always fails when trying to clone the projects submodules.

this is my .gitmodules file:

[submodule "api"]
        path = api
        url = ../api.git
        branch = my_working_branch

this is my .gitlab-ci.yml file:

  - build
  stage: build
  image: our_image_name
    - ./ -a build -g MODEL

this is my command line:

gitlab-runner exec docker build-model

but then I get error messages like this:

Submodule 'api' (/home/user/projects/api.git) registered for path 'api'
fatal: repository '/home/user/projects/api.git' does not exist
fatal: clone of '/home/user/projects/api.git' into submodule path '/builds/project-0/api' failed
Failed to clone 'api'. Retry scheduled
fatal: clone of '/home/user/projects/api.git' into submodule path '/builds/project-0/api' failed
Failed to clone 'api' a second time, aborting
ERROR: Job failed: exit code 1
FATAL: exit code 1

I’ve tryied setting the CI_REPOSITORY_URL variable, but got no success at all…

Any idea of how to set up my local machine so I can play around with the CI configurations without having push every little test setting?

Better yet, anyway to use my local folder as the volume where it will be built?

I’m seeing the same problem, did you find a workaround/solution? It’s only an issue with running the gitlab-runner locally, works OK on the Gitlab CI environment.

Unfortunately not… it kept working only on the CI environment, and directly never on my machine.

I have the same problem. Before I discoveredthis post on the GitLab Forum I posted a question about it on Stack Overflow (, which so far has not received any replies.

So I guess this still is impossible.

1 Like