Skip to content

Make git operations non-interactive; gh credential fallback for push#16

Merged
adamw merged 1 commit into
masterfrom
git-non-interactive-push
Jun 12, 2026
Merged

Make git operations non-interactive; gh credential fallback for push#16
adamw merged 1 commit into
masterfrom
git-non-interactive-push

Conversation

@adamw

@adamw adamw commented Jun 12, 2026

Copy link
Copy Markdown
Member

Flow subprocesses have no usable TTY, so a git HTTPS credential prompt or an ssh key-passphrase prompt blocks the flow forever instead of failing. Route every git invocation through a new gitProc helper that applies a non-interactive environment: GIT_TERMINAL_PROMPT=0 disables the HTTPS prompt, and -o BatchMode=yes appended to GIT_SSH_COMMAND disables the ssh passphrase prompt (appended, so a custom command is preserved). git and ssh now fail fast under any configuration.

push() additionally injects an additive, github.com-scoped, last-resort credential helper (!gh auth git-credential) for that one invocation, so HTTPS pushes authenticate via the gh login the PR flows already require even when git has no credential helper configured. It is appended after any config-file helper (a working setup still wins) and is inert for other hosts and SSH.

This fixes flows hanging on "Push branch" when the repo uses an SSH→HTTPS url.insteadOf rewrite with no git credential helper.

Flow subprocesses have no usable TTY, so a git HTTPS credential prompt or
an ssh key-passphrase prompt blocks the flow forever instead of failing.
Route every git invocation through a new `gitProc` helper that applies a
non-interactive environment: GIT_TERMINAL_PROMPT=0 disables the HTTPS
prompt, and `-o BatchMode=yes` appended to GIT_SSH_COMMAND disables the
ssh passphrase prompt (appended, so a custom command is preserved). git
and ssh now fail fast under any configuration.

push() additionally injects an additive, github.com-scoped, last-resort
credential helper (`!gh auth git-credential`) for that one invocation, so
HTTPS pushes authenticate via the gh login the PR flows already require
even when git has no credential helper configured. It is appended after
any config-file helper (a working setup still wins) and is inert for
other hosts and SSH.

This fixes flows hanging on "Push branch" when the repo uses an SSH→HTTPS
url.insteadOf rewrite with no git credential helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@adamw adamw merged commit 73a7781 into master Jun 12, 2026
4 checks passed
@adamw adamw deleted the git-non-interactive-push branch June 12, 2026 19:45
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