@@ -45,6 +45,15 @@ if [[ ! -d .git ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 统一远程仓库为 SSH 地址
|
||||
GIT_REPO_URL="${GIT_REPO_URL:-git@git.yqidian.com:jacy/dukang.git}"
|
||||
CURRENT_URL="$(git remote get-url "$GIT_REMOTE" 2>/dev/null || true)"
|
||||
if [[ "$CURRENT_URL" != "$GIT_REPO_URL" ]]; then
|
||||
log "SET remote $GIT_REMOTE -> $GIT_REPO_URL (was: ${CURRENT_URL:-none})"
|
||||
git remote set-url "$GIT_REMOTE" "$GIT_REPO_URL" 2>/dev/null \
|
||||
|| git remote add "$GIT_REMOTE" "$GIT_REPO_URL"
|
||||
fi
|
||||
|
||||
git fetch "$GIT_REMOTE"
|
||||
git checkout "$GIT_BRANCH"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user