1.1K Views

GIT102 - Installing Git & Setup Guide

Step-by-step guide to installing Git on Windows, macOS, and Linux, and configuring your development environment properly.

Setting up Git correctly is the first practical step in becoming comfortable with version control.
In this chapter, we will walk through installing Git on Windows, macOS, and Linux, and configure your system with essential Git settings.

Why Proper Installation Matters

A correct Git setup ensures that your commits are traceable and consistent across all your projects.
Incorrect or missing configuration may lead to issues such as anonymous commits, inconsistent formatting, or authentication errors when working with remote repositories.


Installing Git on Windows

The easiest way to install Git on Windows is through the official installer:

  1. Visit the official Git website:
    https://git-scm.com/download/win

  2. Download the newest installer.

  3. Run the installation wizard.

Recommended installer options:

  • Choose "Git from the command line and also from 3rd-party software"
  • Select your preferred editor (VS Code is a common choice)
  • Enable Unix-style line endings
  • Use Git Credential Manager

Verify installation:

git --version

Installing Git on macOS

Using Homebrew (recommended):

brew install git

Without Homebrew, download from the official page:
https://git-scm.com/download/mac

Verify installation:

git --version

Installing Git on Linux

Ubuntu / Debian

sudo apt update
sudo apt install git

Fedora

sudo dnf install git

Arch Linux

sudo pacman -S git

Verify installation:

git --version

First-Time Git Configuration

Set your username:

git config --global user.name "Your Name"

Set your email:

git config --global user.email "your.email@example.com"

Check current configuration:

git config --list

Setting a Default Editor

Use VS Code:

git config --global core.editor "code -w"

Use Vim:

git config --global core.editor "vim"

Enabling Helpful Git Features

Auto-correct typos:

git config --global help.autocorrect 1

Colorized output:

git config --global color.ui auto

Verifying Everything Works

Run a simple command to ensure Git is responding:

git status

If you see a message like:

fatal: not a git repository (or any of the parent directories): .git

This simply means you are not inside a Git repository yet.
You will initialize one in the next chapter.


Summary

In this chapter, you learned:

  • How to install Git on Windows, macOS, and Linux
  • How to configure your username and email
  • How to set your preferred code editor
  • How to enable helpful Git convenience settings
  • How to verify that Git is installed and working properly

Next, you will learn how to create your first Git repository and start tracking your project files.