diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 540dd471d259d7b7581de031fb06fb98296fe921..c1e6f8e3c35df0e8c7b1c8b0f2169424d0858d4f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -186,7 +186,7 @@ build-spack-env-on-runner:
     - spack repo add .
     - spack env create $SPACK_DEV_ENV spack.yaml
     - spack env activate $SPACK_DEV_ENV
-    - spack install -y -j2 --fresh --test root
+    - spack install --overwrite -y -j2 --fresh --test root
   after_script:
     - mkdir spack_logs
     - |
@@ -261,7 +261,7 @@ sync-gitlab-spack-instance:
     # There is a known spack bug (https://github.com/spack/spack/issues/29447) in installing test dependencies for installation tests. The workaround suggested
     # in the issue is to NOT concretize separately, but simply remove the .lock file and let the enironment be concretized by the spack install command:
     - rm $SPACK_ROOT/var/spack/environments/$SPACK_NFS_ENV/spack.lock || echo "No spack.lock file"
-    - spack install -y -j2 --fresh --test root
+    - spack install --overwrite -y -j2 --fresh --test root
     - spack module tcl refresh -y
     - spack reindex
     - spack env loads -r
@@ -287,5 +287,5 @@ sync-gitlab-spack-instance:
       - spack_logs
     when: always
   rules:
-    - if: '$CI_COMMIT_BRANCH =~ /test-spacktests-workaround/ && $CI_PROJECT_NAMESPACE =~ /technical-coordination/'
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_NAMESPACE =~ /technical-coordination/
       when: manual
diff --git a/install_spack_env.sh b/install_spack_env.sh
index c5aaa511890310e7df2b1f8f615b4e9812643b76..2cb37f4501375909e9abab11b1efa89b28b97ca1 100644
--- a/install_spack_env.sh
+++ b/install_spack_env.sh
@@ -54,7 +54,7 @@ spack env activate $EBRAINS_SPACK_ENV
 # remove the .lock file and let the enironment be concretized by the spack install command:
 rm $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/spack.lock || echo "No spack.lock file"
 # install the environment, use 2 jobs to reduce the amount of required RAM
-spack install -y -j2 --fresh --test root
+spack install --overwrite -y -j2 --fresh --test root
 
 # rebuild spack's database
 spack reindex