What is the difference between global and local configuration in git?

Git uses a hierarchical config approach in which settings of a broader scope are inherited if not overriden.

On the top level is the system config (all users, usually in /etc/git), then there is the global config (which can override system defaults with personal ones, located in the home directory of the user, e.g. $HOME/.gitconfig or $HOME/.config/git/config) and finally there is the local config for a repository (.git/config in the repository root) which can override all above and set repository specific options.

All configuration files have the same syntax, but a different scope.

This offers a lot of flexibility.

Leave a Comment

tech