Force ssh batch mode to avoid hidden auth prompts during fetch#310
Open
fischeti wants to merge 1 commit into
Open
Force ssh batch mode to avoid hidden auth prompts during fetch#310fischeti wants to merge 1 commit into
fischeti wants to merge 1 commit into
Conversation
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>
04e3e36 to
5be339e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GIT_TERMINAL_PROMPT=0only suppresses git's own prompts. Over SSH, auth prompts (host key, password, passphrase) come fromsshitself 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=yestoGIT_SSH_COMMANDso ssh fails fast with a clear error instead of prompting. An existing userGIT_SSH_COMMANDis preserved, and a user-setBatchModestill wins.