Search code examples
gitsystemglobalgit-config

gitconfig: locations of git configuration files


How can I find/list the global and the users config files? I mean "Git-native functionality", not Linux commandos like find.


Solution

  • In this question a comment indicated how to know which file is related to --system, --global and --local.

    In short you just use --edit to git config:

    git config --system --edit
    git config --global --edit
    git config --local --edit
    

    If you replace the environment-variable EDITOR with e.g. echo you can receive it in a variable, ie. you can use it programmatically:

    t=`EDITOR=echo git config --system --edit`
    echo $t
    

    prints /etc/gitconfig in my case.