Customizing Git

As you already know, when you install Git, you have to configure your username and e-mail, but this isn't the only one configuration you can do:

Erik@server~:$ git config --global user.name 'Erik'
Erik@server~:$ git config --global user.email 'erik@mymail.com'

Git uses a series of configuration files to perform various activities. First, Git checks the /etc/gitconfig file that contains configurations for every user.

Then, Git looks in ~/.gitconfig, which is specific to each user. Finally, Git checks the .git/config file inside the repository.

There are a lot of options available, but we will cover only the commonly used. You can see a list of all options executing this:

Erik@server~:$ git config -help

You will find a lot of options ...

Get Git Best Practices Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.