Setting Up Git For the First Time (git config)

Share this post

This post is part of the complete guide on Git and Github

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.

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


Subscribe to my Newsletter


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.

Enjoyed This Post?