Skip to content

fix: pin git system config to /etc/gitconfig, not /root#22

Merged
julian-goldstein merged 1 commit into
masterfrom
fix/git-system-config-prefix
Jun 23, 2026
Merged

fix: pin git system config to /etc/gitconfig, not /root#22
julian-goldstein merged 1 commit into
masterfrom
fix/git-system-config-prefix

Conversation

@julian-goldstein

Copy link
Copy Markdown
Contributor

Problem

The vendored static git aborts with fatal: unable to access '/root/etc/gitconfig': Permission denied (exit 128) wherever it runs as a non-root user — which broke yeet new (clone of the script template) downstream in the yeet CLI.

Root cause: git's own Makefile defaults prefix to $HOME. build/Dockerfile.git builds as root in Alpine, so prefix=/root got baked into the binary and its compiled-in system config path became /root/etc/gitconfig. That path is unreadable wherever the relocatable binary actually runs (/root is mode-700), so git aborts reading it before doing any work. The in-container self-test only passed because it ran as root, where /root/... is readable.

Fix

  • Pass prefix=/usr sysconfdir=/etc to the make build, so the system config resolves to the conventional /etc/gitconfig (absent-or-readable on a normal host) instead of /root/etc/gitconfig.
  • Add a non-root git init probe to the build self-test, which reproduces the original failure mode and guards against the regression recurring.

Verification

Built locally with docker buildx ... -f build/Dockerfile.git:

  • Both self-tests pass, including the new confirmed: git init works as non-root.
  • strings git | grep etc/gitconfig/etc/gitconfig; no /root/... config path remains.

[bump:patch] so CI cuts a new release carrying the fixed binary.

🤖 Generated with Claude Code

git's Makefile defaults `prefix` to $HOME. The build runs as root in
Alpine, so /root got baked in and the static binary's compiled-in
system config path became /root/etc/gitconfig. Wherever the relocatable
binary actually runs that path is unreadable (and /root is mode-700), so
every invocation aborted with "unable to access '/root/etc/gitconfig':
Permission denied" before doing any work.

Pin `prefix=/usr sysconfdir=/etc` so the system config resolves to the
conventional /etc/gitconfig, which is absent-or-readable on a normal
host.

The existing in-container self-test ran as root, which is exactly why
the bad path slipped through — root could read /root/.... Add a second
`git init` probe as a non-root user, which reproduces the original
failure mode and guards the regression.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@julian-goldstein julian-goldstein merged commit 92b3685 into master Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant