Tutorial 1 · beginner · 8 min

Install and configure Git

Install Git on macOS, Windows or Linux and set the handful of settings every developer should have.

Updated

Before you can branch, merge or flow anywhere, you need Git installed and told who you are.

Install

macOS: the easiest route is Homebrew:

brew install git

(Running git --version without Homebrew offers to install Apple’s Command Line Tools, which include Git.)

Windows: download Git for Windows from git-scm.com. It includes Git Bash, a terminal that understands the commands on this site.

Linux (Debian/Ubuntu):

sudo apt update && sudo apt install git

Check it worked:

git --version

Tell Git who you are

Every commit records an author. Set yours once, globally:

git config --global user.name "Ada Lovelace"
git config --global user.email "ada@example.com"

Use the same email as your GitHub/GitLab account so commits link to your profile.

Settings worth setting

# Name new repositories' first branch "main"
git config --global init.defaultBranch main

# Make `git pull` rebase your local commits instead of creating merge commits
git config --global pull.rebase true

# Pick an editor for commit messages (VS Code shown; use nano/vim if you prefer)
git config --global core.editor "code --wait"

# Nicer, colour-coded output
git config --global color.ui auto

See everything you’ve set:

git config --global --list

Line endings on Windows: Git for Windows’ installer asks about this. “Checkout Windows-style, commit Unix-style” (core.autocrlf true) is the safe default for most teams.

Next

You’re ready to create your first repository.

One Git tip a week

Short, practical, no spam. Get the free printable Gitflow cheat sheet when you join.

Newsletter launching soon.