feat(script): add auto-heal for corrupt git repo
This commit is contained in:
parent
9c4aee8c86
commit
35138518b2
|
|
@ -56,8 +56,15 @@ else
|
||||||
echo "[Pre-Flight] Repository exists. Pulling latest..."
|
echo "[Pre-Flight] Repository exists. Pulling latest..."
|
||||||
cd "$REPO_DIR"
|
cd "$REPO_DIR"
|
||||||
git config --global --add safe.directory "$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
|
# SYMLINK SETUP
|
||||||
# We want Nginx to use the configs from the repo (dynamic) instead of the baked-in ones (static).
|
# We want Nginx to use the configs from the repo (dynamic) instead of the baked-in ones (static).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue