File tree Expand file tree Collapse file tree 4 files changed +34
-52
lines changed
test/java/com/smalltrend/service/crm Expand file tree Collapse file tree 4 files changed +34
-52
lines changed Original file line number Diff line number Diff line change @@ -178,9 +178,17 @@ jobs:
178178 if [ -d .git ]; then
179179 git config --global --add safe.directory "$DEPLOY_PATH" || true
180180 sudo git config --system --add safe.directory "$DEPLOY_PATH" || true
181- git fetch origin
182- git checkout main
183- git pull --ff-only origin main
181+
182+ # Try normal git first; fallback to sudo git when .git is root-owned.
183+ if git -C "$DEPLOY_PATH" fetch origin; then
184+ git -C "$DEPLOY_PATH" checkout main
185+ git -C "$DEPLOY_PATH" pull --ff-only origin main
186+ else
187+ echo "Normal git fetch failed, retry with sudo git..."
188+ sudo git -C "$DEPLOY_PATH" fetch origin
189+ sudo git -C "$DEPLOY_PATH" checkout main
190+ sudo git -C "$DEPLOY_PATH" pull --ff-only origin main
191+ fi
184192 fi
185193
186194 if [ ! -f "$ENV_FILE" ]; then
You can’t perform that action at this time.
0 commit comments