Re: Bug report: GIT_CONFIG and user.email/name

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

 



GIT_CONFIG is confusing, GIT_CONFIG_GLOBAL is what I need.

Thanks a lot! 

On Jul 14 2021, at 8:10 pm, Jeff King <peff@xxxxxxxx> wrote:

> On Wed, Jul 14, 2021 at 07:10:27PM +0200, German Lashevich wrote:
> 
>> I've faced an issue while trying to use a non-default .gitconfig file
>> via specifying
>> GIT_CONFIG environment variable.
>> 
>> What did you do before the bug happened? (Steps to reproduce your issue)
>> 
>> ```
>> # use custom .gitconfig via GIT_CONFIG envvar:
>> mkdir -p /tmp/git-test/repo
>> cat <<EOT > /tmp/git-test/.gitconfig
>> [user]
>>     name = John Doe
>>     email = john@xxxxxx
>> EOT
>> cd /tmp/git-test/repo
>> git init
>> export GIT_CONFIG=/tmp/git-test/.gitconfig
>> echo Hi > readme.txt
>> git add readme.txt
>> git commit -m 'Initial commit'
>> ```
> 
> The GIT_CONFIG variable doesn't work that way. It is not a general
> mechanism used by all of Git, but rather a specific feature of the
> git-config program (and even there it is a historical wart; you should
> use "git config --file" instead).
> 
> One of these variables is probably more helpful:
> 
>  $ man git | sed -n '/GLOBAL/,/^$/p'
>  GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM
>    Take the configuration from the given files instead from global or
>    system-level configuration files. If GIT_CONFIG_SYSTEM is set, the
>    system config file defined at build time (usually /etc/gitconfig)
>    will not be read. Likewise, if GIT_CONFIG_GLOBAL is set, neither
>    $HOME/.gitconfig nor $XDG_CONFIG_HOME/git/config will be read. Can
>    be set to /dev/null to skip reading configuration files of the
>    respective level.
> 
> Note that they're new in v2.32.0.
> 
> -Peff
> 



[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