fix: pin git system config to /etc/gitconfig, not /root#22
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The vendored static
gitaborts withfatal: unable to access '/root/etc/gitconfig': Permission denied(exit 128) wherever it runs as a non-root user — which brokeyeet new(clone of the script template) downstream in theyeetCLI.Root cause: git's own Makefile defaults
prefixto$HOME.build/Dockerfile.gitbuilds as root in Alpine, soprefix=/rootgot 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 (/rootis 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
prefix=/usr sysconfdir=/etcto themakebuild, so the system config resolves to the conventional/etc/gitconfig(absent-or-readable on a normal host) instead of/root/etc/gitconfig.git initprobe 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: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