diff --git a/bash/zstart b/bash/zstart index 7780e87..a3b540b 100644 --- a/bash/zstart +++ b/bash/zstart @@ -66,10 +66,12 @@ start_prep() { # dim " env $name=$val" done < <(jq -r --arg k "$key" '.projects[$k].start.env // {} | to_entries[] | "\(.key)\t\(.value)"' "$ZCONFIG") if [ "$(zproj "$key" .start.gitPull)" = "true" ] && [ -d "$root/.git" ]; then - local last - last="$( (cd "$root" && git pull --ff-only 2>&1) | tail -1 )" - dim " git pull: $last" - (cd "$root" && git rev-parse HEAD >/dev/null 2>&1) || warn " Auto-pull failed - run 'git pull' manually if needed." + # GIT_TERMINAL_PROMPT=0 so a repo that needs credentials fails fast instead + # of blocking the server start on an interactive "Username for ..." prompt. + local out rc + out="$( (cd "$root" && GIT_TERMINAL_PROMPT=0 git pull --ff-only 2>&1) )"; rc=$? + dim " git pull: $(printf '%s\n' "$out" | tail -1)" + [ "$rc" -eq 0 ] || warn " Auto-pull skipped (exit $rc) - starting with the current checkout. (git needs credentials here, or set start.gitPull=false)" fi } diff --git a/zstart.ps1 b/zstart.ps1 index eaada37..363d23d 100644 --- a/zstart.ps1 +++ b/zstart.ps1 @@ -199,14 +199,18 @@ function Invoke-ProjectStartPrep { } if ($Proj.start.gitPull -and (Test-Path (Join-Path $Proj.localRoot ".git"))) { Push-Location -LiteralPath $Proj.localRoot + # GIT_TERMINAL_PROMPT=0 so a repo that needs credentials fails fast + # instead of blocking the server start on a "Username for ..." prompt. + $prev = $env:GIT_TERMINAL_PROMPT; $env:GIT_TERMINAL_PROMPT = "0" try { $pullOut = git pull --ff-only 2>&1 $last = ($pullOut | Select-Object -Last 1) Write-Host " git pull: $last" -ForegroundColor DarkGray if ($LASTEXITCODE -ne 0) { - Write-Host " Auto-pull failed - run 'git pull' manually if needed." -ForegroundColor Yellow + Write-Host " Auto-pull skipped - starting with the current checkout. (git needs credentials here, or set start.gitPull=false)" -ForegroundColor Yellow } } finally { + $env:GIT_TERMINAL_PROMPT = $prev Pop-Location } }