Git is the most widely used version control system in software development today. Before you can clone repositories, manage branches, or commit code, you need to make sure Git is installed on your system.
In this quick guide, you’ll learn how to check if Git is installed—and what to do if it’s not.
✅ Step 1: Open Your Command-Line Interface
Depending on your operating system:
- Windows: Open Command Prompt or PowerShell
- macOS: Open Terminal
- Linux: Open your system’s Terminal
🧪 Step 2: Run the Git Version Command
In the terminal or command prompt, type the following command:
git --version
✅ If Git is installed:
You’ll see the installed version of Git, like this:
git version 2.43.0
This confirms Git is installed and working correctly on your system.
❌ If Git is not installed:
You’ll see an error like:
'git' is not recognized as an internal or external command
(Windows)command not found: git
(macOS/Linux)
🧭 Step 3: What to Do If Git Is Not Installed
If Git is not installed, follow these steps based on your operating system:
💻 Windows
- Download Git for Windows from the official site:
👉 https://git-scm.com/download/win - Run the installer and follow the setup instructions.
- After installation, restart your terminal and run
git --version
again to confirm.
🍏 macOS
- Use Homebrew (recommended):
brew install git
- Or install Xcode Command Line Tools (includes Git):
xcode-select --install
🐧 Linux
For Debian/Ubuntu-based systems:
sudo apt update
sudo apt install git
For Fedora:
sudo dnf install git
For Arch Linux:
sudo pacman -S git
🧠 Tip: Set Up Git After Installation
After installing Git, it’s good practice to set your global username and email:
git config --global user.name "Your Name"
git config --global user.email "yo*@ex*****.com"
You can verify your configuration with:
git config --list
📌 Summary
Task | Command |
---|---|
Check if Git is installed | git --version |
Install Git (Windows) | git-scm.com |
Install Git (macOS) | brew install git or xcode-select --install |
Install Git (Linux) | sudo apt install git (or relevant package manager) |