diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6797d49a3e18c929f3a7dea2a1a86869c9be47bf..a610ea3d75c6d5fc08e3a9e4555c244293ae0c72 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -77,6 +77,10 @@ stages:
     # something like that... Without this we get errors like
     #     fatal: couldn't find remote ref refs/heads/master
     - git checkout -b master
+    # The repo command does not like shallow repos
+    - if [ "$(git rev-parse --is-shallow-repository)" = "true" ] ; then
+        git fetch --unshallow ;
+      fi
     # Create/maintain a mirror of all manifest repositories in runner
     # persistent storage, and use that as reference when initializing the
     # build repo, effectively reducing the time spent fetching git repos to