diff --git a/nix/wp-cache.nix.sh b/nix/wp-cache.nix.sh
index c2d075d1fef53995fc1f048838a8dce4cbb38029..1b63aa8170b19ac8d4a29d355e7076f1d9094ef0 100755
--- a/nix/wp-cache.nix.sh
+++ b/nix/wp-cache.nix.sh
@@ -21,7 +21,10 @@
 #                                                                        #
 ##########################################################################
 
-commit="$(git ls-remote git@git.frama-c.com:frama-c/wp-cache.git HEAD | cut -f1)"
+commit="$(git ls-remote git@git.frama-c.com:frama-c/wp-cache.git HEAD)"
+if [ $? != 0 ]; then exit 1; fi
+
+commit=$(echo "$commit" | cut -f1)
 
 cat >./nix/wp-cache.nix << EOL
 { lib, stdenv } :