SetupBeginner10 min read

How to Install Git (macOS / Windows / Linux)

A step-by-step guide to installing Git on macOS, Windows, and Linux. Covers installation methods for each OS and initial configuration.

What Is Git?

Git is a version control tool that tracks changes to your files. It's the standard tool used by developers worldwide.

NOTE

Git is already installed in WebTerm Learn courses. This guide is for setting up Git on your own computer.

Installing on macOS

There are two ways to install Git on macOS.

Option 1: Xcode Command Line Tools (Recommended)

The simplest method. Open Terminal and run:

xcode-select --install

Click "Install" when the dialog appears. This installs Git along with other developer tools.

Option 2: Using Homebrew

If you have the Homebrew package manager installed:

brew install git
NOTE

If you don't have Homebrew yet, follow the instructions at brew.sh.

Installing on Windows

Option 1: Git for Windows (Recommended)

1

Download the installer

Visit git-scm.com and download the Windows installer.

2

Run the installer

Run the downloaded file. You'll see several configuration screens — the defaults are fine for most users. Just click "Next" through each step.

3

Open Git Bash

After installation, open Git Bash from the Start menu. This is a terminal where you can use Git.

Option 2: Using WSL (Windows Subsystem for Linux)

If you have WSL set up, you can install Git inside your Linux environment:

sudo apt update && sudo apt install git -y
NOTE

For WSL setup instructions, see "Getting Started with WSL: Run Linux on Windows."

Installing on Linux

Use your distribution's package manager.

Ubuntu / Debian

sudo apt update && sudo apt install git -y

Fedora / RHEL

sudo dnf install git -y

Arch Linux

sudo pacman -S git

Verifying the Installation

On any OS, run the following to confirm Git is installed:

git --version

If you see a version number, you're good to go:

git version 2.45.0

Initial Configuration

Before using Git, set your name and email. These are recorded in every commit (change record) you make.

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

Verify your settings with:

git config --list
NOTE

The --global flag sets the configuration for your entire machine. To use different settings for a specific project, run the command without --global.

Next Steps

Git is installed and configured. In WebTerm Learn's "Git Introduction" course, you can practice Git commands right in your browser. Everything you learn there works the same way in the environment you just set up.

Related Courses

Ready to practice? Try these interactive courses.

Related Articles

Back to Articles