From eddec0bb6e5a0d0098841f813b646bceb5bcdf38 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 9 Jun 2026 21:41:12 -0400 Subject: [PATCH] sync scripts: self-heal gitea remote if a fresh clone dropped it Re-clones from GitHub leave repos with only origin; pull/push now re-add the gitea mirror remote automatically so the mirror cannot silently drift. Co-Authored-By: Claude Opus 4.8 (1M context) --- sync-pull-all.sh | 4 ++++ sync-push-all.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sync-pull-all.sh b/sync-pull-all.sh index 262dad49..060df222 100755 --- a/sync-pull-all.sh +++ b/sync-pull-all.sh @@ -14,6 +14,10 @@ GITEA="https://git.nexasystems.ca/admin" pull_one() { local d="$1" local br; br=$(git -C "$d" symbolic-ref --short HEAD 2>/dev/null || echo main) + # self-heal: re-add the gitea mirror remote if a fresh clone dropped it + if [ "$d" != "." ] && ! git -C "$d" remote get-url gitea >/dev/null 2>&1; then + git -C "$d" remote add gitea "https://git.nexasystems.ca/admin/$d.git" 2>/dev/null || true + fi if git -C "$d" pull --ff-only -q origin "$br" 2>/dev/null; then echo "updated: $d" else diff --git a/sync-push-all.sh b/sync-push-all.sh index e29cb70b..22d70eb8 100755 --- a/sync-push-all.sh +++ b/sync-push-all.sh @@ -11,6 +11,10 @@ cd "$(dirname "$0")" || exit 1 push_one() { local d="$1" local br; br=$(git -C "$d" symbolic-ref --short HEAD 2>/dev/null || echo main) + # self-heal: re-add the gitea mirror remote if a fresh clone dropped it + if [ "$d" != "." ] && ! git -C "$d" remote get-url gitea >/dev/null 2>&1; then + git -C "$d" remote add gitea "https://git.nexasystems.ca/admin/$d.git" 2>/dev/null || true + fi local flag="" [ -n "$(git -C "$d" status --porcelain --untracked-files=no)" ] && flag=" [HAS UNCOMMITTED CHANGES - not pushed]" local any=0