diff --git a/ci-tools/update-production b/ci-tools/update-production
index 1ed0a12efd582939ca41d66b3826535551259bcf..3b2ab0f7f4dd29128d0e5adc4d04bf551bc14760 100755
--- a/ci-tools/update-production
+++ b/ci-tools/update-production
@@ -15,6 +15,11 @@ main() {
     local TARGET_BRANCH=$1
     shift
 
+    # Make sure the things we want to talk about are locally known.  GitLab
+    # seems to prefer to know about as few refs as possible.
+    checkout_git_ref "$SOURCE_BRANCH"
+    checkout_git_ref "$TARGET_BRANCH"
+
     # If there have been no changes we'll just abandon this update.
     if ! ensure_changes "$SOURCE_BRANCH" "$TARGET_BRANCH"; then
 	echo "No changes."
@@ -26,6 +31,13 @@ main() {
     create_merge_request "$TOKEN" "$SERVER_URL" "$PROJECT_ID" "$SOURCE_BRANCH" "$TARGET_BRANCH" "$NOTES"
 }
 
+checkout_git_ref() {
+    local REF=$1
+    shift
+
+    git fetch origin "$REF"
+}
+
 ensure_changes() {
     local SOURCE_BRANCH=$1
     shift