How to Install Git on Windows, Mac, and Linux
Git is the world's most widely used version control system — a tool that tracks changes to files over time, lets you roll back to earlier versions, and makes collaboration on code (or any text-based project) dramatically easier. Whether you're a developer setting up a new machine or someone just getting started with coding, installing Git is usually one of the first steps.
Here's a clear walkthrough of how Git installation works across the major operating systems, plus the variables that affect which method makes most sense for your setup.
What Git Actually Does Before You Install It
Before diving into the steps, it helps to know what you're actually putting on your machine. Git is a command-line tool at its core — it runs in a terminal or shell and manages a hidden database of file snapshots (called a repository) inside your project folders.
Many people also use Git through a graphical interface (like GitHub Desktop, Sourcetree, or VS Code's built-in Git panel), but those tools still rely on Git being installed underneath. Installing Git correctly is the foundation everything else sits on.
How to Install Git on Windows 🪟
Windows doesn't ship with Git, so you'll need to download and run an installer.
The standard method:
- Go to git-scm.com — the official Git website
- Click Download for Windows — it detects your system automatically
- Run the
.exeinstaller - Work through the setup wizard — most default options are fine for beginners
The installer includes Git Bash, a terminal emulator that lets you run Git commands in a Unix-style shell. It also adds Git to your system's PATH, meaning you can use it from PowerShell or Command Prompt too.
Key choices during Windows installation:
| Option | What It Means |
|---|---|
| Default editor | The text editor Git opens for commit messages (Vim, Notepad++, VS Code, etc.) |
| PATH environment | Controls where Git is accessible — "Git from the command line and 3rd-party software" is the most flexible |
| Line ending conversions | Affects how Git handles vs — important when collaborating across Mac/Windows |
| Credential manager | Helps store your login credentials securely |
Most users can accept defaults and adjust later.
How to Install Git on macOS 🍎
Mac users have a few routes, and the right one depends on how you work.
Option 1: Xcode Command Line Tools macOS includes Git as part of Apple's developer tools. Open Terminal and type:
git --version If Git isn't already installed, macOS will prompt you to install the Xcode Command Line Tools. This is the simplest path for most Mac users — no external downloads required.
Option 2: Homebrew If you already use Homebrew (a popular Mac package manager), you can install a more up-to-date version of Git with:
brew install git This is the preferred route for developers who want finer control over their Git version and easier updates in the future.
Option 3: Official installer The git-scm.com site also offers a Mac .dmg installer if you'd rather avoid the terminal for the initial setup.
How to Install Git on Linux
Linux distributions typically make Git available through their package manager, which is the fastest and most reliable method.
| Distribution | Command |
|---|---|
| Ubuntu / Debian | sudo apt install git |
| Fedora | sudo dnf install git |
| Arch Linux | sudo pacman -S git |
| openSUSE | sudo zypper install git |
After installation, verify it worked with git --version. On Linux, Git integrates naturally with the system and is generally the smoothest installation experience of the three platforms.
Setting Up Git After Installation
Installing Git is step one. Before it's actually useful, you'll want to configure two things:
git config --global user.name "Your Name" git config --global user.email "[email protected]" These details get attached to every commit (saved change) you make. They're how collaborators and platforms like GitHub know who made which change. This matters even if you're working solo — many workflows and hosting platforms rely on this metadata.
Factors That Shape Your Installation Experience
Git's core installation is straightforward, but a few variables affect which method works best for a given setup:
- Operating system version — Older versions of macOS or Linux may have package manager limitations or require additional steps
- Technical comfort level — Terminal-based installs are faster but assume some comfort with command-line interfaces
- Workflow — Someone using VS Code will benefit from ensuring Git integrates with the editor during setup; someone using GitHub Desktop needs the underlying Git installed but may never touch a terminal directly
- Organizational or school environments — Some managed machines restrict software installation, requiring IT permission or specific approved methods
- Windows Subsystem for Linux (WSL) — Developers on Windows who work in a Linux environment via WSL will want to install Git inside the WSL environment separately from any Windows-side Git installation
What "Installing Git" Doesn't Cover
Getting Git on your machine is distinct from:
- Creating a GitHub, GitLab, or Bitbucket account — those are hosted platforms that work with Git, but aren't Git itself
- Authenticating with a remote — after installation, you'll need to set up SSH keys or a personal access token if you want to push code to a remote repository
- Learning Git commands — installation is mechanical; actually using Git (commits, branches, merges) is a separate learning curve
The installation process itself is reliable and well-documented across all platforms. Where things tend to diverge is in what comes next — which tools, workflows, and hosting platforms you connect Git to, and how deeply you need to configure it for your specific development environment.