diff --git a/scripts/pre-flight.sh b/scripts/pre-flight.sh index 002fcd8..8815d5b 100644 --- a/scripts/pre-flight.sh +++ b/scripts/pre-flight.sh @@ -56,8 +56,15 @@ else echo "[Pre-Flight] Repository exists. Pulling latest..." cd "$REPO_DIR" git config --global --add safe.directory "$REPO_DIR" - git pull -fi + + # Attempt pull, if fails (lock file or corruption), wipe and re-clone + if ! git pull; then + echo "[Pre-Flight] ERROR: Git pull failed (likely corrupt ref/lock). Re-cloning..." + cd / + rm -rf "$REPO_DIR" + mkdir -p "$REPO_DIR" + git clone "$GIT_URL" "$REPO_DIR" + fi # SYMLINK SETUP # We want Nginx to use the configs from the repo (dynamic) instead of the baked-in ones (static).