git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Configuration overrides via environment variable

From
Jakub Narebski <jnareb@gmail.com>
Date
Jan 28, 2008, 22:58 UTC
Message-ID
<m3tzkx8smg.fsf@localhost.localdomain>
In-Reply-To
<20080128205837.GB5788@efreet.light.src>
Jan Hudec <bulb@ucw.cz> writes:
Show 8 quoted lines
> On Mon, Jan 28, 2008 at 12:08:10 +1100, David Symonds wrote:
> > 
> > I'm using Git in some scripts, and wanted to get its colorised output
> > even when it is not going to a tty. I don't want to permanently change
> > ~/.gitconfig or the per-repo config; I just want to set color.status
> > (and perhaps others) to "always" for a one-off run. I suppose I could
> > munge the config files, storing the previous value and restoring it
> > later, but that's messy.
Cannot you just use --color option?
 
Show 10 quoted lines
> > Ideally, an environment variable like GIT_EXTRA_CONFIG or something
> > would be nice, so I could just do:
> > 
> > GIT_EXTRA_CONFIG="color.status=always" git status | ...
> > 
> > Thoughts? Does this already exist, and I've overlooked it?
> 
> Quickly looking at the git-config manpage, there does not seem to be a way to
> provide alternate config file via GIT_CONFIG and/or GIT_CONFIG_LOCAL
> variables. I don't know how good match for your problem that would be.

GIT_CONFIG_LOCAL *replaces* repository configuration file; the global and the system-wide configuration files will still be read. GIT_CONFIG is the only config file read.

So you could I guess concatenate repo config with "[color] status=always", although you would get warnings if color.status is already set...

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Jan HudecNext: David Symonds
Message 3 of 4 in “Configuration overrides via environment variable”
  1. David SymondsJan 28, 2008
  2. Jan HudecJan 28, 2008
  3. Jakub NarebskiJan 28, 2008
  4. David SymondsJan 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.