Closed
fix: clear extraheader from all git config scopes to prevent duplicate Authorization headers in fork PRs#48987
Conversation
Copilot
AI
changed the title
[WIP] Fix duplicate Authorization headers in fork create_pull_request
fix: clear extraheader from all git config scopes to prevent duplicate Authorization headers in fork PRs
Jul 29, 2026
Collaborator
|
@copilot push changes |
Contributor
Triage: fix: clear extraheader from all git config scopes
|
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.
overridePersistedExtraheader/restorePersistedExtraheaderread from all git config scopes (--get-all) but write only to local scope. When the checkout token lives in global scope, the override adds a second local entry rather than replacing the global one — git sees twoAuthorizationheaders → HTTP 400. On each retry, restore writes another local copy while the global entry persists, so the visible count grows (read 1,read 2,read 3...) and every attempt fails.Changes
git_auth_helpers.cjsclearExtraheaderFromAllWritableScopes(key, cwd)— runsgit config --local --unset-allandgit config --global --unset-all, silently ignoring errors (key absent, scope unwritable)overridePersistedExtraheaderandrestorePersistedExtraheader--replace-allto--add(correct after an explicit clear; the previous key is gone)git_auth_helpers.test.cjs--replace-all→--add)extra_empty_commit.test.cjs--replace-allfor the override/restore sequence