Git needs to be installed on your computer before you can start tracking changes, creating repositories, or working with GitHub.
The good news: installing Git is simple, and it takes only a few minutes on any operating system.
This guide explains exactly how to install Git on Windows, macOS, and Linux — step by step.
🪟 Installing Git on Windows
Git on Windows is installed using an easy setup wizard.
This process also includes Git Bash automatically.
Step-by-Step Instructions
- Go to the official Git website:
👉 https://git-scm.com/downloads - Under Windows, click Download.
- Open the downloaded installer.
- Click Next through the setup screens.
The default options are perfect for beginners. - When choosing the default editor, select:
- Visual Studio Code (recommended)
- or keep Vim if preferred
- When asked about the terminal, choose:
- “Use Windows Terminal” or
- “Use Git Bash only”
- Continue with the default settings and click Install.
- After installation, open Command Prompt, PowerShell, or Git Bash, and type:
git --version
If Git is installed correctly, the version number will appear.
🍎 Installing Git on macOS
macOS users have three easy ways to install Git. Any method works fine.
Option 1: Install Git Using Xcode Command Line Tools (Recommended)
Open Terminal and run:
xcode-select --install
A popup will appear. Click Install.
This installs Git automatically.
Option 2: Install Git Using Homebrew
If Homebrew is installed, run:
brew install git
If Homebrew is not installed, install it first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then install Git using the first command.
Option 3: Install from Git’s Official Site
Download the macOS installer from:
👉 https://git-scm.com/download/mac
Follow the on-screen instructions.
Verify Installation
Open Terminal and run:
git --version
You should see the installed version.
🐧 Installing Git on Linux
Most Linux distributions come with Git preinstalled.
If not, you can install it using your package manager.
Ubuntu / Debian
Open Terminal:
sudo apt update
sudo apt install git
Fedora
sudo dnf install git
CentOS / RHEL
sudo yum install git
Arch Linux
sudo pacman -S git
Verify Git Installation
Run:
git --version
If Git is installed, the version number will appear.
📌 After Installing Git: Set Your Identity
Git uses your name and email to record who makes each commit.
This information appears in your commit history.
🌍 Set Your Global Identity (Recommended for Beginners)
This applies to all Git projects on your computer.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Most beginners only need this global configuration.
📁 Set Identity Only for a Specific Project (Optional)
If you want different identity details for certain projects
(e.g., personal email for personal projects and work email for company projects),
you can set a local identity inside that project’s folder.
Important:
The folder must already be a Git repository before setting local config.
This means one of the following must be true:
- The folder was created using:
git init - OR the folder was created by cloning a repository:
git clone <repo-url>
Steps to set local identity:
- Navigate to the project folder:
cd path/to/project - Set the project-specific identity:
git config user.name "Project-Specific Name" git config user.email "project@example.com"
This identity applies only to this project and overrides the global settings.
🔎 How Git Chooses Which Identity to Use
Git checks settings in this order:
- Local config (project-level)
- Global config (user-level)
- System config (machine-level, rarely used)
So if a local identity exists, Git always uses that for this project.
🎯 Final Thoughts
Installing Git is the very first step in your version control journey.
Once Git is set up on your system, you’re ready to:
- Create repositories
- Track changes
- Connect with GitHub
- Use commands like
add,commit, andpush - Work with branches and collaboration tools
This simple setup unlocks everything that comes next in your Git learning path.