diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh
index 9e1ead256481229099c1b9737b3ada17622eda82..3f23d7d0aec0f79cf3b0a0da728697b5e55d696f 100755
--- a/scripts/rebuild.sh
+++ b/scripts/rebuild.sh
@@ -25,12 +25,6 @@ CI_COMMIT_REF_NAME="${CI_COMMIT_REF_NAME:-@local}"
 # The way to clone the repositories for this build
 GITLAB_CHECKOUT_STRATEGY="git@gitlab.idiap.ch:"
 
-# If we build inside a Docker container, disables strict ssh key checking
-if [[ "${OS_SLUG}" == "linux-64" ]]; then
-  log_info 'Disabling strict host key checking for SSH...'
-  echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
-fi
-
 # Overrides some stuff
 if [ "${CI_COMMIT_REF_NAME}" == "@local" ]; then
   BOB_PACKAGE_VERSION="unknown"
@@ -40,6 +34,12 @@ fi
 source ${basedir}/_ci/functions.sh
 unset BOB_PACKAGE_VERSION
 
+# If we build inside a Docker container, disables strict ssh key checking
+if [[ "${OS_SLUG}" == "linux-64" ]]; then
+  log_info 'Disabling strict host key checking for SSH...'
+  echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
+fi
+
 # Setup project variables
 export_env CI_PROJECT_DIR
 export_env CI_PROJECT_NAME