Skip to main content

git_command

Function git_command 

Source
pub fn git_command() -> Command
Expand description

Builds a git command that can neither prompt nor print on the terminal.

  • GIT_TERMINAL_PROMPT=0 stops git asking for a username/password on the tty.
  • GIT_SSH_COMMAND pins host-key handling so ssh never asks to confirm a fingerprint (see ssh_command_val).
  • GIT_ASKPASS/SSH_ASKPASS are neutralised so no GUI or console credential helper can be spawned behind the alternate screen.
  • The protocol allowlist blocks ext::-style transports from a hostile .gitmodules or remote URL.
  • stdin is /dev/null, stdout and stderr are pipes. A caller that only reads stdout must drain stderr too (see spawn_pipe_reader), or use output() / wait_with_output() which drain both.