diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ad18e34647701096d49d4dca0bc0edc37c7e032d..95ef7ea24e2b7575c07878389d063356a3a1ba81 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -42,8 +42,8 @@ build-job-Z2:       # This job runs in the build stage, which runs first.
   stage: build
   script:
     # move to fpga_imp directory and run the fpga build script for pynq z2
-    - git submodule init
-    - git pull --recurse-submodules
+    - git submodule foreach --recursive git submodule init
+    - git fetch --recurse-submodules
     - source set_env.sh
     - cd ./nanosoc_tech/fpga/
     - make build_fpga FPGA=z2
@@ -66,8 +66,8 @@ build-job-ZCU104:       # This job runs in the build stage, which runs first.
   stage: build
   script:
    # move to fpga_imp directory and run the fpga build script for pynq z2 
-    - git submodule init
-    - git pull --recurse-submodules
+    - git submodule foreach --recursive git submodule init
+    - git fetch --recurse-submodules
     - source set_env.sh
     - cd ./nanosoc_tech/fpga
     - make build_fpga FPGA=zcu104