Web lists-archives.com

Re: disable interactive prompting




On Wed, Oct 04, 2017 at 09:10:48AM -0700, Ernesto Alfonso wrote:

> Waiting for git-push synchronously slows me down, so I have a bash
> alias/function to do this in the background. But when my origin is https, I
> get an undesired interactive prompt. I've tried to disable by
> redirecting stdin:
> 
> git push ${REMOTE} ${BRANCH} &>/dev/null </dev/null
> 
> but I still get an interactive prompt.
> 
> Is there a way to either
> 
> 1. disable interactive prompting
> 2. programmatically determine whether a git command (or at least a git
> push) would interactively prompt

I assume the prompt is for credentials, since that's generally the only
thing git-push will prompt for.

Try:

  $ git help git | sed -ne '/PROMPT/,/^$/p'
         GIT_TERMINAL_PROMPT
           If this environment variable is set to 0, git will not prompt on
           the terminal (e.g., when asking for HTTP authentication).

Of course that just stops the prompting. If Git needs a credential and
you don't provide it, then the push will fail.

For advice on that that, try "git help credentials".

-Peff