Get the file location of git config values


All the configurations related to git such as the user.email and user.name are stored in the gitconfig files that can be stored at different places based on the option you provided (system, global, local) while setting them up,

  1. $PATH/etc/gitconfig: Stores the system config values, which are set using --sytem option
  2. ~/.gitconfig: Stores the personal/global values which are set using --global option.
  3. .git/config: Stores values at the local repository level, set using the --local option.

You can see all the config values using the command: git config -l or git config --list

Example:
% git config -l

user.env=uat
user.email=you@example.com
user.name=Code2care
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
user.team=dev

In order to see the file location of all the config values add the option --show-origin

Example:
git config --list --show-origin 

file:/etc/gitconfig     user.env=uat
file:/root/.gitconfig   user.email=you@example.com
file:/root/.gitconfig   user.name=Code2care
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        user.team=dev
file location git config values


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap