fix(go-ci): replace persistent http.extraHeader with job-scoped GIT_CONFIG env vars#60
Merged
Merged
Conversation
…aHeader http.extraHeader doesn't satisfy git's credential check (causes "could not read Username" in go mod download) and persists in ~/.gitconfig on self-hosted runners, where it collides with actions/checkout@v4's own extraHeader and produces "Duplicate header: Authorization" / exit 128. Replace it with GIT_CONFIG_COUNT/KEY/VALUE env vars exported via GITHUB_ENV, using url.insteadOf semantics (the mechanism Go's own FAQ recommends for private modules). This is job-scoped, never touches ~/.gitconfig, and uses a different config key than checkout so it cannot collide. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nirmal-bluefunda
approved these changes
Jun 8, 2026
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
go-ci.yml's "Configure Git for private modules" step writes:to the runner user's persistent
~/.gitconfig. On self-hosted runners this:actions/checkout@v4later copies the pollutedglobal config into its sandbox and adds its own
extraHeader, producingremote: Duplicate header: "Authorization"/exit code 128on checkout.go mod downloadfails with
fatal: could not read Username for 'https://github.com': terminal prompts disabled, becauseextraHeaderadds a header but neverregisters a credential.
This regressed in a495be6 ("use http.extraHeader instead of URL-embedded
token"), which replaced the previously-working
url.insteadOfapproach.Fix
Replace the
git config --globalcall with job-scopedGIT_CONFIG_COUNT/GIT_CONFIG_KEY_0/GIT_CONFIG_VALUE_0environment variables (exported via$GITHUB_ENV), expressing the sameurl.<token>@github.com/.insteadOfrewrite that Go's own FAQ recommends for private-module auth
(https://golang.org/doc/faq#git_https).
This:
~/.gitconfig— nothing persists on the runner, no cleanup neededurl.*.insteadOf, a different config key than checkout'shttp.*.extraHeader— cannot collidego mod downloadworks without promptingTesting
goprivate-enabled job:go mod downloadsucceeds forgithub.com/bluefunda/bffactions/checkout@v4succeeds with no Duplicate-header / exit 128git config --global --list --show-originon the runner shows nohttp.https://github.com/.extraheaderafter the runcai-bff,cai-llm-router, andrelease-foundryconsumers🤖 Generated with Claude Code