From de6f8bec427b73427603a751f7a3e4036d9fb0e9 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 20 May 2026 16:30:17 +0200 Subject: [PATCH] bootstrap.sh: preserve URL scheme in credentials file git credential helper does exact prefix match including scheme. Hardcoding https:// breaks for in-LAN clones using http://192.168.8.121:3000 (which LXC 105 needs because its DNS doesn't have the split-horizon override). Co-Authored-By: Claude Opus 4.7 (1M context) --- bootstrap.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index d59af58..12a7f94 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -56,11 +56,12 @@ configure_gitea_creds() { local creds_file=$creds_dir/git-credentials mkdir -p "$creds_dir" chmod 700 "$creds_dir" - # Format the credential URL: protocol://user:token@host - # Extract host from REPO_HTTPS for the credential line. - local host + # Format the credential URL: ://user:token@host (scheme must match + # the actual REPO_HTTPS — git's credential helper does exact prefix match). + local proto host + proto=$(echo "$REPO_HTTPS" | sed -E 's|^(https?)://.*|\1|') host=$(echo "$REPO_HTTPS" | sed -E 's|^https?://([^/]+).*|\1|') - printf 'https://%s:%s@%s\n' "$GITEA_USER" "$GITEA_TOKEN" "$host" > "$creds_file" + printf '%s://%s:%s@%s\n' "$proto" "$GITEA_USER" "$GITEA_TOKEN" "$host" > "$creds_file" chmod 600 "$creds_file" # Point git at this store globally for root (so future pulls work too). git config --global credential.helper "store --file=$creds_file"