Skip to content

Fix configureGitAuth for actions/checkout@v6 credential storage#920

Open
StuporHero wants to merge 1 commit intoanthropics:mainfrom
StuporHero:fix/checkout-v6-credential-cleanup
Open

Fix configureGitAuth for actions/checkout@v6 credential storage#920
StuporHero wants to merge 1 commit intoanthropics:mainfrom
StuporHero:fix/checkout-v6-credential-cleanup

Conversation

@StuporHero
Copy link

@StuporHero StuporHero commented Feb 9, 2026

Summary

  • Fix configureGitAuth to handle actions/checkout@v6 credential storage
  • Add tests covering both v4 (direct config) and v6 (includeIf) credential styles

Problem

actions/checkout@v6 (https://github.com/actions/checkout/releases/tag/v6.0.0, PR actions/checkout#2286) changed how
persist-credentials works. Instead of setting http.*.extraheader directly in the local git config, it writes the credential to a separate file
and includes it via includeIf.gitdir.

configureGitAuth only ran git config --unset-all http.*.extraheader, which clears the local config but not the included file. The read-only
GITHUB_TOKEN extraheader persisted and took precedence over the app token set in the remote URL, causing git push to fail with 403.

Fix

After the existing --unset-all, also find and remove includeIf.gitdir entries and delete their associated credential config files — matching
what checkout v6's own post-step cleanup does.

Test plan

  • Added test/git-config.test.ts with two tests:
    • v4 style (direct extraheader): passes before and after the fix
    • v6 style (includeIf): fails before the fix, passes after
  • All 653 existing tests continue to pass

actions/checkout@v6 changed persist-credentials to store the
extraheader in a separate config file included via includeIf.gitdir,
rather than setting it directly in the local git config.

configureGitAuth only cleared extraheaders from the local config
via git config --unset-all, leaving the includeIf-based credentials
in place. The read-only GITHUB_TOKEN extraheader then took precedence
over the app token in the remote URL, causing 403 on git push.

Now also removes includeIf.gitdir entries and their associated
credential config files.

Fixes anthropics#907
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