Use --bare instead of --mirror for our reference repos.

This should fix slow and hanging Git operations on the workers.
diff --git a/gitbundle/gitbundle.sh b/gitbundle/gitbundle.sh
index 785965c..9ca8a96 100755
--- a/gitbundle/gitbundle.sh
+++ b/gitbundle/gitbundle.sh
@@ -1,23 +1,26 @@
 #!/bin/bash
 
-set -euxo pipefail
+set -euo pipefail
 
 BUILDKITE_API_TOKEN=$(gsutil cat "gs://bazel-encrypted-secrets/buildkite-api-token.enc" | \
     gcloud kms decrypt --project "bazel-public" --location "global" --keyring "buildkite" --key "buildkite-api-token" --plaintext-file "-" --ciphertext-file "-")
 
 rm -rf bazelbuild
 gsutil cat "gs://bazel-git-mirror/bazelbuild-mirror.tar" | tar x
+# mkdir bazelbuild
 cd bazelbuild
 
+git config pack.compression 9
+
 function mirror() {
     repo="$1"
     remote_name="$(echo -n $repo | tr -C '[[:alnum:]]' '-')"
     if [[ -d $remote_name ]]; then
-        git -C "${remote_name}" remote set-url origin "${repo}"
-        git -C "${remote_name}" remote update --prune
+        git -C "${remote_name}" pull
     else
-        git clone --mirror "${repo}" "${remote_name}"
+        git clone --bare "${repo}" "${remote_name}"
     fi
+    git -C "${remote_name}" repack -a -d -F --threads=0
 }
 
 for repo in $(curl -sS -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" "https://api.buildkite.com/v2/organizations/bazel/pipelines?per_page=100" \
@@ -36,6 +39,7 @@
 cd ..
 
 # Verify that it works:
+rm -rf bazel-test
 git clone --reference bazelbuild/https---github-com-bazelbuild-bazel-git https://github.com/bazelbuild/bazel.git bazel-test
 
 tar c bazelbuild | gsutil cp - "gs://bazel-git-mirror/bazelbuild-mirror.tar"