By admin , 28 April 2026

Introduction

Installing Git is straightforward on every major platform. This page walks through the recommended installation method for Linux, macOS, and Windows, and shows how to verify the install.

Linux

Most Linux distributions ship Git in their default package repositories. Use your package manager:

# Debian, Ubuntu
sudo apt update
sudo apt install git

# Fedora, RHEL, Rocky
sudo dnf install git

# Arch
sudo pacman -S git

For the latest version, the official Git project maintains a PPA for Ubuntu (ppa:git-core/ppa) and source tarballs at git-scm.com.

macOS

macOS includes a stub git that prompts you to install Apple's command line developer tools. Three options work well:

  1. Run xcode-select --install to get Apple's bundled Git.
  2. Use Homebrew: brew install git for the latest upstream Git.
  3. Download the official installer from git-scm.com.
brew install git
git --version

Windows

The recommended installer is Git for Windows from git-scm.com. It bundles Git, an OpenSSH client, a Bash shell (Git Bash), and a credential helper. Alternatively use winget or Chocolatey:

winget install --id Git.Git -e
choco install git

During the GUI install you will be asked about line endings, default editor, and PATH integration. The defaults (checkout Windows-style, commit Unix-style; Git from the command line) are sensible for most users.

Verifying the install

git --version
git help -a | head

Any version 2.30 or newer is fine for the topics in this manual. Older versions lack many quality-of-life features such as git switch and git restore.

Updating Git

Keeping Git current matters: many features in this manual require Git 2.30 or newer, and security fixes ship regularly. On Linux, your package manager handles updates automatically. On macOS with Homebrew, run brew upgrade git periodically. On Windows, git update-git-for-windows (built into Git for Windows) checks for and installs the latest release in one command.

git --version
brew upgrade git
git update-git-for-windows

If you suddenly see deprecation warnings or commands behaving differently after an upgrade, read the release notes in /usr/share/doc/git/RelNotes/ or on git-scm.com; Git's upgrade path is gentle but occasional defaults do change.

Common mistakes

On macOS, forgetting that the stock Apple-provided Git lags upstream by months or years. Use Homebrew if you want recent features. On Windows, mixing PowerShell and Git Bash can confuse new users about which shell they are in. On Linux, installing from a third-party tarball without removing the distribution package can put two git binaries on PATH; use which -a git to check. Finally, do not run Git installers as sudo unless your package manager explicitly requires it.