Re: GIT_TERMINAL_PROMPT environment variable isn't honored properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-06-29 at 13:46:44, Ondrej Pohorelsky wrote:
> Hi, we've run into an issue when running git as part of an automated system.
> 
> When you set the GIT_TERMINAL_PROMPT environment variable as 0 you
> expect git to die instead of trying to issue a prompt on the terminal.
> 
> 
> $ GIT_TERMINAL_PROMPT=0

When you write this in the shell, the shell doesn't by default export
this variable to processes it invokes, like git.  If you want to do
that, you need to write:

$ export GIT_TERMINAL_PROMPT=0

or

$ GIT_TERMINAL_PROMPT=0
$ export GIT_TERMINAL_PROMPT

> $ echo $GIT_TERMINAL_PROMPT
> 0
> $ git clone https://github.com/some/non-existent-repo
> Cloning into 'non-existent-repo'...
> Username for 'https://github.com':
> 
> 
> You get expected behaviour only when you set the GIT_TERMINAL_PROMPT
> variable just before you run git clone.
> 
> 
> $ GIT_TERMINAL_PROMPT=0 git clone https://github.com/some/non-existent-repo
> Cloning into 'non-existent-repo'...
> fatal: could not read Username for 'https://github.com': terminal
> prompts disabled

When you write this, the variable is always exported to the command, since
it's not possible to use export here and otherwise this syntax wouldn't
be very useful.

Hopefully this explains why you're seeing some different behavior
between the two situations.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux