Fetching submodules fails irregularly
Issue has only started to affect me after the migration from Github runners to a self hosted runner, but it happens once every 2 to 3 workflow runs, so I can't say it is deterministic. Here's the part of the workflow file where it fails:
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
submodules: recursive
And the logs of the action, where it fails:
Fetching submodules
/usr/bin/git submodule sync --recursive
Synchronizing submodule url for 'oisp-backend'
Synchronizing submodule url for 'oisp-beam-rule-engine'
Synchronizing submodule url for 'oisp-frontend'
Synchronizing submodule url for 'oisp-mqtt-gw'
Synchronizing submodule url for 'oisp-services'
Synchronizing submodule url for 'oisp-websocket-server'
/usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1 --recursive
Submodule path 'oisp-backend': checked out '56c4655bdd5ed108314b4d28cabc2626f7d32665'
Submodule path 'oisp-beam-rule-engine': checked out 'fd51cacf4bf557015046[81](https://github.com/Open-IoT-Service-Platform/platform-launcher/runs/5826320940?check_suite_focus=true#step:2:81)e19ef28f681ae07cb4'
Error: fatal: unable to access 'https://github.com/Open-IoT-Service-Platform/oisp-frontend.git/': The requested URL returned error: 400
Unable to fetch in submodule path 'oisp-frontend'; trying to directly fetch 81594d36ef420d6[82](https://github.com/Open-IoT-Service-Platform/platform-launcher/runs/5826320940?check_suite_focus=true#step:2:82)c5da0d7e81e50d9d7f005[83](https://github.com/Open-IoT-Service-Platform/platform-launcher/runs/5826320940?check_suite_focus=true#step:2:83):
Error: fatal: unable to access 'https://github.com/Open-IoT-Service-Platform/oisp-frontend.git/': The requested URL returned error: 400
Fetched in submodule path 'oisp-frontend', but it did not contain 81594d36ef420d682c5da0d7e81e50d9d7f00583. Direct fetching of that commit failed.
Error: The process '/usr/bin/git' failed with exit code 1
The link itself is working and and there is an existing commit with the given SHA, so I don't understand why would the request return a "Bad Request" error and why it would only do it once every 2 or 3 workflow runs.
Check your global and system git config config to see if they contain any http.extraheader=AUTHORIZATION.... We worked through an issue yesterday where a malformed auth header in the global git config was causing the server to return 400 for any authenticated git commands.
I had this exact same issue, and there was indeed a http.extraheader=AUTHORIZATION... line in my self-hosted runner git config. Removing it fixed it!