From ce25e736258eb753e673a8af49873255da21607e Mon Sep 17 00:00:00 2001 From: root Date: Wed, 20 May 2026 18:01:47 +0200 Subject: [PATCH] bootstrap.sh: store gitea cred helper in /etc/gitconfig, not /root/.gitconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The systemd sync timer runs git without HOME set, so git config --global (which writes /root/.gitconfig) is invisible to the timer's process — the timer fails with 'could not read Username' silently. Switching to --system writes to /etc/gitconfig which is HOME-agnostic. Migration for already-bootstrapped hosts captured in agent-enrollment.md troubleshooting. Co-Authored-By: Claude Opus 4.7 (1M context) --- bootstrap.sh | 6 ++++-- operations/agent-enrollment.md | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 3c4c430..a03f237 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -63,8 +63,10 @@ configure_gitea_creds() { host=$(echo "$REPO_HTTPS" | sed -E 's|^https?://([^/]+).*|\1|') 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" + # Point git at this store system-wide (/etc/gitconfig) so the systemd + # sync timer's git — which runs as root without HOME set — finds it. + # --global writes to /root/.gitconfig which the timer doesn't read. + git config --system credential.helper "store --file=$creds_file" echo "[bootstrap] wrote gitea credentials to $creds_file" } diff --git a/operations/agent-enrollment.md b/operations/agent-enrollment.md index e9e6786..4fe215f 100644 --- a/operations/agent-enrollment.md +++ b/operations/agent-enrollment.md @@ -205,6 +205,7 @@ The CLI prints a follow-up checklist that the operator must do manually: | `address already in use` for FastMCP | FastMCP defaults to 127.0.0.1:8000 | Fixed: server now sets `mcp.settings.host/port` from env (default `0.0.0.0:9810`) | | `homelab: no age key at /etc/age/key.txt` even after bootstrap | `/etc/age` is 0700 root, so non-root users couldn't even stat the key file; existence check returned False under regular users | Fixed in commit `df6aca8`: the CLI re-execs `sops -d` via sudo when invoked as a non-root user. On older deployments, re-link the CLI with `sudo ln -sfn /opt/homelab-context/bin/homelab /usr/local/bin/homelab` after the 5-min sync. | | `homelab` CLI doesn't pick up repo updates | Pre-`02db…` bootstrap copied the binary instead of symlinking | One-time migration: `sudo ln -sfn /opt/homelab-context/bin/homelab /usr/local/bin/homelab`. New bootstraps use the symlink, which auto-tracks the synced repo. | +| `homelab-context-sync.service` journal shows `fatal: could not read Username for 'https://git.hubris.network'` | Pre-fix bootstrap set the gitea credential helper via `git config --global`, which writes to `/root/.gitconfig` — invisible to the systemd timer's git process (no HOME set). | One-time migration: `sudo git config --system credential.helper "store --file=/etc/homelab-context/git-credentials"`. New bootstraps store the helper in `/etc/gitconfig` instead. | ## Changelog