Once you have Git on you system, here are few things you want to do to initialize your Git environment.

Git config and the config files

Git config is to get and set configuration variables that control all aspects of how git looks and operates. They store in three different places:

1. /etc/gitconfig file:

Contains values for every user on the system and all their repositories. The command below read and writes from this file
git config -- system

2. ~/.gitconfig or ~/.config/git/config file:

You can make Git read and write to this file by command below
git config --global

3. config file in the Git directory(.git/config)

Current git working directory repo.

Note: Each level overrides values in the previous level, for example, values in .git/config overwrite those in /etc/gitconfig.

Set identity

Here is the command to set user name and e-mail address:

git config --global user.name "Fibre village"
git config --global user.email "This email address is being protected from spambots. You need JavaScript enabled to view it."

Note: You only need to do this once.

Set Editor

This command is to setup the default text editor

git config --global core.editor emacs
git config --global core.editor vim

Checking Settings

To list all the settings:

git config --list

Note: You may see keys more than once, because Git reads the same keys from different files, In this case, Git uses the last value for each unique key it sees.

To see a specific key value, type

git config user.name

Getting help

the following three ways to get the manual page:

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

For example, to get manpage for config command

git help config




Comments powered by CComment