Categories
git

Git Tutorial Part 1: Git Configuration

This Git Config Basics Tutorial will help you find out how configuration works and how you can configure your git

Types of Configuration

System Wide:

This configuration file is found at: /etc/gitconfig. This contains the default values for all users on the system.

git config --system

Global/Per User:

Found at: ~/.gitconfig. This is the configuration of a specific user.

git config --global

Project/Repo Specific:

Found at .git/config of each project.

So the configuration process is much like that of apache with the system: httpd.conf

global: mywebsite-vhost.conf
project: .htacess

Configure you Git Identity:

This is the identity data that is stored with every commit you make, o it is good practice to make the email valid and name professional.

git config --global user.name "Number 1"
git config --global user.email admin@number1.co.za

You can use (–system, –global or no argument for project specific config)

Configure your Git Editor:

Configuring your git editor is an important step, as we all have out favourite editors. The default for most system is vim however you change it using the following command:

git config --global core.editor emacs

The same editor can be used as your diff tool and mergetool:

git config --global merge.tool meld
git config --global diff.tool meld

I find that using a graphical merge and diff tool is easier for me.

Checking your Git Settings:

git config --list
user.name=Number 1
user.email=admin@number1.co.za
color.status=auto

Git Config Basics Help

git help config
git help <verb>
git <verb> --help
man git-<verb>

Taken from Chapter 1: Pro Git