diff --git a/.ci/clone.sh b/.ci/clone.sh
index 1210419de3c4eba80bc32bf432c7cc235eb58076..571d8dbe7137a73eb123db0a2fc2d445523ae84c 100755
--- a/.ci/clone.sh
+++ b/.ci/clone.sh
@@ -97,7 +97,7 @@ if [ -n "${SPACK_GERRIT_CHANGE:-}" ] && [ -z "${SPACK_GERRIT_REFSPEC:-}" ]; then
             else
                 if [ "${change_status}" = "MERGED" ]; then
                     echo "This change depends on an already merged spack changeset! Ignoring.." >&2
-                    unset SPACK_GERRIT_REFSPEC
+                    SPACK_GERRIT_REFSPEC=""
                 fi
             fi
 
@@ -134,7 +134,7 @@ if [ -n "${SPACK_GERRIT_CHANGE:-}" ] && [ -z "${SPACK_GERRIT_REFSPEC:-}" ]; then
                 fi
 
                 # prevent SPACK_GERRIT_REFSPEC from getting checked out again below
-                unset SPACK_GERRIT_REFSPEC
+                SPACK_GERRIT_REFSPEC=""
             fi
         fi
     done