curious: where does git store user information?

If you do not store user information in your configuration files Git looks in the environment for committer information, using the variables GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, GIT_AUTHOR_NAME, and GIT_AUTHOR_EMAIL. In absence of these variables, your username and host name are used to construct a value. So even without any user information stored in configuration files two users will have different committer information.


There are 3 default paths for the config file.

  • Repository itself: <your_git_repository>/.git/config
  • User home directory: ~/.gitconfig
  • System-wide directory: $(prefix)/etc/gitconfig

The --global option always use the home directory. Note that git will always try to read all of them. If it finds one, it loads it, and moves to the next one. Local takes precedence over global, which takes precedence over system-wide. It uses a simple key-merging algorithm.

Reference: git-config FILES

Tags:

Git