diff --git a/containers/debian/base.Dockerfile b/containers/debian/base.Dockerfile
index d0d571518290e83aa238d0dc4a7e6cae7f677ac1..0c305537604976b2e89775b30780d8b9b799c9ef 100644
--- a/containers/debian/base.Dockerfile
+++ b/containers/debian/base.Dockerfile
@@ -156,7 +156,7 @@ git config --global user.name "EIC Container Build Service"
 git config --global advice.detachedHead false
 git clone --filter=tree:0 https://github.com/${SPACK_ORGREPO}.git ${SPACK_ROOT}
 git -C ${SPACK_ROOT} checkout ${SPACK_VERSION}
-git -C ${SPACK_ROOT} --no-auto
+git -C ${SPACK_ROOT} gc --no-auto
 if [ -n "${SPACK_CHERRYPICKS}" ] ; then
   SPACK_CHERRYPICKS=$(git -C ${SPACK_ROOT} rev-list --topo-order ${SPACK_CHERRYPICKS} | grep -m $(echo ${SPACK_CHERRYPICKS} | wc -w)  "${SPACK_CHERRYPICKS}" | tac)
   eval "declare -A SPACK_CHERRYPICKS_FILES_ARRAY=(${SPACK_CHERRYPICKS_FILES})"