DEV Community

Cover image for How to configure git for the first time? - Linux environment
Robertopaolo Ramirez
Robertopaolo Ramirez

Posted on • Updated on

How to configure git for the first time? - Linux environment

Commands we will use

git config —list = list your git configuration

git config —system = git configuration for the machine in general

git config —global = user configuration for any project

The first thing you should do when installing Git is to configure your username and email address. This is important because each commit uses this information, and it is immutably stamped on the commits you start creating:

$ git config --global user.name ramirezmz
$ git config --global user.email ramirezmz@exemplo.br
Enter fullscreen mode Exit fullscreen mode

Other configs that help in everyday life

Your favorite editor

When there is a need to edit messages and/or other things that need text editing, git will use some editor by default, but you can already tell git which one to use, in my case, I prefer to use neovim.

git config --global core.editor nvim
Enter fullscreen mode Exit fullscreen mode

Autocomplete git

Let's say you mistyped or forgot the command to add items, git will recommend commands similar to what you tried to type. Also, the correct command will be executed after the x seconds you put

git suggestion

git config --global help.autocorrect 20
Enter fullscreen mode Exit fullscreen mode

Default branch

git config --global init.defaultbranch=master
Enter fullscreen mode Exit fullscreen mode

Links

https://git-scm.com/docs/git-config

Top comments (0)