Git comes with this handy tool that let’s you manage your Git configuration with ease.
(Default) Local configuration values are stored and managed at the repository level. The values are stored in a file found in the repo’s
If you are planning to set some configuration only to be used by the specific repo you are in, then go ahead with using
git config --local user.email "email@example.com"
Global configuration is one level above Local. These configuration are user-specific and managed through the
.gitconfigfile in user’s home directory:
If you want your configuration to reflect to all your repo’s in the system, then go ahead with using
git config --global user.email "firstname.lastname@example.org"
System-level configuration applies to every user on the system, which means if none of the the local or the global values overrides the system level Git configuration value will be used. These configurations are true for all the repos' in the system and is managed through the
git config --system user.email "email@example.com"
Listing all the configurations
To see all the configuration values, use the command:
git config --list
It can get quite messy when you have configuration values coming from multiple sources. To see the origin of the value as well add
git config --list --show-origin
The first chore the you always need to do after setting up Git is setting up your user name and email address. This is required because Git attaches this piece of information to ever changeset that you create in Git, known as Git commit.
Which level of configuration should we use? Because the details are user specific in most cases, the
optimum answer is
git config --global user.name "Sayan Chowdhury" git config --global user.name "firstname.lastname@example.org"
Let’s verify this in the global settings file:
$ cat ~/.gitconfig [user] name = Sayan Chowdhury email = email@example.com
What are the other alternative will you use to verify?
Git invokes the editor for a lot of command for example while doing a commit,
or rebasing your commits. When you type these commands it’s fire up the editor
infront of you. Now, each of us has their own choice of editor so vim gives you
option to configure which editor you would like to use.
I’m a vim user, thus for me the command would be:
git config --global core.editor "vim"
Colors in Git
Merge and diff tools
Git configurations you might find useful
More details on the following config coming soon
To more on git config, read