From 8ea5646be534e3810d96f9defa67b94dae94ca37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 11:51:16 +0800 Subject: [PATCH] ops: ensure data repo remote matches configured ssh --- scripts/db_snapshot_import.sh | 2 ++ scripts/db_snapshot_publish.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/db_snapshot_import.sh b/scripts/db_snapshot_import.sh index f6ecfa7..ed6e608 100755 --- a/scripts/db_snapshot_import.sh +++ b/scripts/db_snapshot_import.sh @@ -54,9 +54,11 @@ if [[ "$DB_DATABASE" == "" || "$DB_USERNAME" == "" ]]; then exit 24 fi +# 数据仓工作区:固定目录,但每次都会强制将 remote 指向当前 DATA_REPO_SSH,避免曾经 clone 过其它仓(如 .wiki.git)导致拉错。 WORK_DIR="/tmp/saasshop-data-repo" if [[ -d "$WORK_DIR/.git" ]]; then echo "[data-repo] updating existing clone: $WORK_DIR" + git -C "$WORK_DIR" remote set-url origin "$DATA_REPO_SSH" git -C "$WORK_DIR" fetch origin git -C "$WORK_DIR" checkout main || git -C "$WORK_DIR" checkout -b main git -C "$WORK_DIR" pull --rebase origin main || true diff --git a/scripts/db_snapshot_publish.sh b/scripts/db_snapshot_publish.sh index 84d9e30..9ac0ac4 100755 --- a/scripts/db_snapshot_publish.sh +++ b/scripts/db_snapshot_publish.sh @@ -119,9 +119,11 @@ cat > "$MANIFEST" <