From 73fca1c74ac43464395cd6674c078b6308bccf50 Mon Sep 17 00:00:00 2001 From: Simone Date: Sun, 10 May 2026 22:10:01 +0200 Subject: [PATCH] =?UTF-8?q?fix(=C2=A73.3):=20Disable=20GCM=20+=20set=20GIT?= =?UTF-8?q?=5FTERMINAL=5FPROMPT=3D0=20in=20WinRM=20guest=20clone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git Credential Manager (GCM) installed by Git for Windows tries to open an interactive credential prompt or wincredman store — both fail in a WinRM session (no TTY, no interactive desktop). Fix: - Set GIT_TERMINAL_PROMPT=0 to suppress all interactive git prompts - Prepend '-c credential.helper=' (empty string) to reset the helper chain before injecting our store-based helper (clearing GCM from the chain) - Custom credential helper (store --file ) then appended only when PAT present Without PAT (public repo): GCM still cleared, no prompt attempted, clean fail if auth is actually required. With PAT: store-based helper used exclusively, GCM never invoked. Co-Authored-By: Claude Sonnet 4.6 --- scripts/Invoke-RemoteBuild.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/Invoke-RemoteBuild.ps1 b/scripts/Invoke-RemoteBuild.ps1 index 78af43c..48b54bb 100644 --- a/scripts/Invoke-RemoteBuild.ps1 +++ b/scripts/Invoke-RemoteBuild.ps1 @@ -245,6 +245,13 @@ try { if ($submodules) { $gitArgs += '--recurse-submodules' } $gitArgs += @($cloneUrl, (Split-Path $workDir -Leaf)) + # Disable interactive credential prompts — WinRM has no TTY + $env:GIT_TERMINAL_PROMPT = '0' + + # Clear any system credential helper (e.g. GCM) that may try to open UI/TTY. + # '-c credential.helper=' (empty) resets the helper chain before we inject ours. + $credHelperArgs = @('-c', 'credential.helper=') + # Credentials via temp .git-credentials file (§1.5: token never in URL, argv, or logs) $tmpCreds = $null if ($patUser -and $patPass) { @@ -252,9 +259,11 @@ try { $credLine = "$($uri.Scheme)://${patUser}:${patPass}@$($uri.Host)" $tmpCreds = "C:\CI\tmp_gc_$([guid]::NewGuid().ToString('N'))" [System.IO.File]::WriteAllText($tmpCreds, $credLine) - $gitArgs = @('-c', "credential.helper=store --file $tmpCreds") + $gitArgs + $credHelperArgs += @('-c', "credential.helper=store --file $tmpCreds") } + $gitArgs = $credHelperArgs + $gitArgs + try { Write-Host "[Guest] Cloning $cloneUrl (branch: $branch)..." & git @gitArgs 2>&1 | ForEach-Object { Write-Host "[Guest Clone] $_" }