Setting Up Git For the First Time (git config)

The Git configuration file is used to store the configuration of a git repository.

If you have never used Git before, you likely need to set it up.

In this tutorial, we will learn things that you can configure when starting with Git.


Subscribe to my Newsletter


The only real requirement is to configure the git user.name and user.email to allow commits and pushes.

Optionally, I will show you other configurations that you could use upon startup.

Installing Git

Before you can use Git, you need to install it. Here are some guides to help you install Git.

Configuring Git

After the Git installation, we need to configure a few things.

Configure Email and User Name (important)

If you are on Windows, open Git Bash, on MacOS, open the Terminal.

From the Terminal

$ git config --global user.name "Your Name"
$ git config --global user.email "youremail@github.com"

Configure Default Editor (optional)

If you want, and this is truly optional, you may define what is your default code editor.

In my case, I use VSCode with Github.

To define Visual Studio Code as the default editor:

$ git config --global core.editor "code --wait"

Configure Git Colors (optional)

The colours can be configured to make git more readable.

$ git config --global color.diff auto
$ git config --global color.status auto
$ git config --global color.branch auto

Conclusion

This was an introduction to the basic Git configurations that can be made upon starting using Version Control.

Other Version Control with Git and Github Posts

Learn Git and Github (Complete Guide)
Basics of Version Control
How to Use Git and Github with VSCode
Enjoyed This Post?