ops: ensure data repo remote matches configured ssh

This commit is contained in:
萝卜
2026-03-18 11:51:16 +08:00
parent ee2e75b057
commit 8ea5646be5
2 changed files with 4 additions and 0 deletions

View File

@@ -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

View File

@@ -119,9 +119,11 @@ cat > "$MANIFEST" <<EOF
EOF
# 准备数据仓工作区
# 数据仓工作区:固定目录,但每次都会强制将 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