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) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-06-09 21:41:12 -04:00
parent 4830613701
commit eddec0bb6e
2 changed files with 8 additions and 0 deletions

View File

@@ -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