Skip to content

actions/checkout@v4 fails with "Duplicate header: Authorization" and throws "The requested URL returned error: 400" #2215

Open
@gauravpk26

Description

@gauravpk26

I'm using actions/checkout@v4 with a Personal access tokens (classic) (TOKEN_GITHUB) that has full repository and workflow permissions, and SSO is enabled for the organization.

My workflow snippet:

- name: Checkout
  uses: actions/checkout@v4
  with:
    token: ${{ secrets.TOKEN_GITHUB }}
    fetch-depth: 0

On some runs, the checkout step fails with:

Run actions/checkout@v4
Syncing repository: <org>/<repo>
Getting Git version info
Copying '/.../.gitconfig' to '/.../_temp/.../.gitconfig'
Temporarily overriding HOME='/.../_temp/...'
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /.../aftersales365-consumer/aftersales365-consumer
Deleting the contents of '/.../aftersales365-consumer/aftersales365-consumer'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
/usr/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
remote: Duplicate header: "Authorization"
fatal: unable to access 'https://github.com/<org>/<repo>/': The requested URL returned error: 400
The process '/usr/bin/git' failed with exit code 128

This happens intermittently and sometimes resolves on re-run.
Would appreciate guidance or a fix to avoid this intermittent failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions