gitlab-ci: fix hanging MSVC jobs

Starting with GitLab Runner 19.x, the runner executes `git credential
reject` in its cleanup stage. This has bad interactions with our build
environment because we install our own version of PortableGit, and the
runner picks up that version of Git. The consequence is that we invoke
PortableGit's default credential manager, which is Git Credential
Manager for Windows. GCM then tries to use Windows Credential Manager,
but it cannot and thus the job hangs in its cleanup phase forever.

Fix this hang by unsetting the credential helper after installing
PortableGit. This means that `git credential reject` becomes a no-op,
and thus the cleanup succeeds again.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt authored and Junio C Hamano committed 2026-09-24 11:30:14 -07:00
1 parent e492974847
commit ce4a600322
1 file changed
+8
+8
View File
@@ -53,3 +53,11 @@ Invoke-Installer msiexec.exe @('/i', $mesonMsi, 'INSTALLDIR=C:\Meson', '/quiet',
$rustMsi = Get-Installer "rust.msi" `
"https://static.rust-lang.org/dist/rust-$RustVersion-x86_64-pc-windows-msvc.msi"
Invoke-Installer msiexec.exe @('/i', $rustMsi, 'INSTALLDIR=C:\Rust', 'ADDLOCAL=Rustc,Cargo,Std', '/quiet', '/norestart')
# Disable Git Credential Manager, which is auto-configured by PortableGit.
# GitLab's runner picks up this Git in its cleanup stage and runs `git
# credential reject`, which hangs in GCM and makes the job time out.
& "C:\Program Files\Git\bin\git.exe" config unset --all --system credential.helper
if ($LASTEXITCODE -ne 0 -and $LASTEXITCODE -ne 5) {
throw "Failed to unset credential.helper with exit code $LASTEXITCODE"
}