Skip to content

TIL: Git Tips #1 - Configuration

Git allowed us to define a configuration variables that control all aspects of how Git looks and operates. These variables can be stored in three different places or three different levels:

  1. project: Project configs level are only available for the current project and stored in .git/config in the project’s directory.

  2. global: Global configs level are only available for all projects for the current user and stored in ~/.gitconfig.

  3. system: System configs level are available for all the users/projects and stored in /etc/gitconfig.

Create a project specific config, you have to execute this under the project’s directory:

$ git config user.name "John Doe"

Create a global config:

$ git config --global user.name "John Doe"

Create a system config:

$ git config --system user.name "John Doe"

And as you may guess, project overrides global and global overrides system.

Note: Project configs are local to just one particular copy/clone of this particular repo, and need to be reapplied if the repo is re-cloned clean from the remote. It changes a local file that is not sent to the remote with a commit/push.

If you have any comments or corrections please feel free to email them to me. Also, if you found any of the content on this website useful consider buy me a coffee ;)