Skip to content

Force ssh batch mode to avoid hidden auth prompts during fetch#310

Open
fischeti wants to merge 1 commit into
masterfrom
fischeti/fix-git-terminal-input
Open

Force ssh batch mode to avoid hidden auth prompts during fetch#310
fischeti wants to merge 1 commit into
masterfrom
fischeti/fix-git-terminal-input

Conversation

@fischeti
Copy link
Copy Markdown
Contributor

@fischeti fischeti commented Jun 2, 2026

GIT_TERMINAL_PROMPT=0 only suppresses git's own prompts. Over SSH, auth prompts (host key, password, passphrase) come from ssh itself and go straight to the terminal, where they hide behind the progress bars — so the fetch looks like it hangs (typically when no SSH key is configured).

Fix: append -o BatchMode=yes to GIT_SSH_COMMAND so ssh fails fast with a clear error instead of prompting. An existing user GIT_SSH_COMMAND is preserved, and a user-set BatchMode still wins.

@fischeti fischeti requested a review from micprog June 2, 2026 20:20
GIT_TERMINAL_PROMPT=0 only suppresses git's own credential prompts. When
fetching over SSH, the authentication prompts (host key confirmation,
password, key passphrase) are emitted by `ssh` directly to the controlling
terminal, bypassing the piped stderr that we parse for progress. With the
progress bars drawn on that same terminal, the prompt is hidden behind them
and the fetch appears to hang indefinitely -- typically for users without a
configured SSH key.

Set GIT_SSH_COMMAND to append `-o BatchMode=yes` so ssh refuses to prompt
and fails fast with a clear error instead, mirroring the GIT_TERMINAL_PROMPT
treatment for git. Any user-provided GIT_SSH_COMMAND is preserved, and since
ssh honors the first value seen for an option, an explicit BatchMode set by
the user still takes precedence.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@fischeti fischeti force-pushed the fischeti/fix-git-terminal-input branch from 04e3e36 to 5be339e Compare June 2, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant