I’m using self hosted runner in my workflow. For some reason, getting the following error in the checkout step
error:
Fetching the repository
/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules --unshallow origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
remote: Duplicate header: "Authorization"
Error: fatal: unable to access 'https://github.com/og/snow/': The requested URL returned error: 400
The process '/usr/bin/git' failed with exit code 128
workflow code:
determine_scope:
runs-on: self-hosted
outputs:
prev_sha: ${{ steps.prev_sha_fetch.outputs.prev_sha }}
deploy: ${{ steps.scope_check.outputs.deploy }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all commit history
persist-credentials: false
- name: Fetch Prev SHA
id: prev_sha_fetch
run: |
prev_sha=$(curl -L -s
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"
-H "X-GitHub-Api-Version: 2022-11-28"
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ inputs.workflow_name }}/runs?branch=main&status=success&per_page=1"
| jq -r '.workflow_runs[0].head_sha'
)
echo "Current SHA: ${{ github.sha }}"
echo "Previous SHA: $prev_sha"
if [[ "$prev_sha" != "null" && -n "$prev_sha" ]]; then
echo "::notice ::Triggered partial deployment"
else
echo "::notice ::Triggered full deployment"
prev_sha='null'
fi
echo "prev_sha=$prev_sha" >> $GITHUB_OUTPUT
tried different checkout versions, also used persist-credentials: false, nothing worked.
1
Your repo or your self-hosted runner (if you are using one) must have a git configuration file that sets git credentials in addition to GitHub workflow setting GITHUB_TOKEN in the auth header.
You may be able to see under Checkout step of your workflow a reference to .gitconfig
or .gitcredentials