Installing Git A Simplified Guide for Linux, macOS and Windows
Git is a powerful version control system used by developers worldwide. Before you start managing your projects with Git, you need to install it on your system. This guide walks you through the installation steps for Linux, macOS, and Windows, plus how to set up Git for your personal use.
🚀 Quick Summary
- Linux: Install via your distro’s package manager (
apt
,dnf
,yum
,pacman
) - macOS: Install using Xcode Command Line Tools or Homebrew
- Windows: Download the official installer or use Winget/Chocolatey package managers
- Configure: Set your username, email, and preferred editor before you start
- Start: Initialize repositories with
git init
and begin version controlling your projects
🐧 Installing Git on Linux
Git is included in most Linux distribution repositories.
Use the appropriate command for your distribution to install Git via the terminal:
1
2
3
4
sudo apt install git # Debian / Ubuntu
sudo dnf install git # Fedora 22 and later
sudo yum install git # Red Hat
sudo pacman -S git # Arch Linux
Tip: You might need administrator privileges (using
sudo
) to install packages.
🍎 Installing Git on macOS
You can install Git on macOS in two main ways:
- Xcode Command Line Tools (recommended for most users):
1
xcode-select --install
- Homebrew (if you already have it installed):
1
brew install git
Download details are available here: Git for macOS.
🪟 Installing Git on Windows
Download the latest Git installer from the official site: Git for Windows.
Alternatively, use these package managers in your Command Prompt or PowerShell: Winget:
1
winget install git
Chocolatey:
1
choco install git.install
⚙️ Basic Git Configuration
After installation, configure Git to identify your commits with your name and email:
1
2
git config --global user.name "Your Name"
git config --global user.email yourname@example.com
Example
1 2 git config --global user.name Anoop Kumar git config --global user.email anoopkumar1119@gmail.com
Why configure this ?
Yourusername
and
Example
1 2 3 commit ff479ca6e8b37785329f28617dcd5fc953875a2b Author: Anoop Kumar <anoopkumar1119@gmail.com> Date: Fri Jun 6 06:53:48 2025 +0200
Set your preferred text editor for commit messages and other Git actions:
- On Linux/macOS (example: nano):
1
git config --global core.editor nano
- On Windows (example: Notepad++):
1
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Verify your configuration settings anytime with:
1
git config --list
Example
1 2 3 core.editor="C:\\Program Files\\Notepad++\\notepad++.exe" -multiInst -notabbar -nosession -noPlugin user.name=Anoop Kumar user.email=anoopkumar1119@gmail.com
📚 Getting Started with Git
Initialize a new Git repository inside any project folder with:
1
git init
This creates a .git
directory that tracks changes and prepares your project for version control.
🛠 Troubleshooting Tips
- Check Git Installation: Run
git --version
to confirm Git is installed and see its version. - Permission Issues: If installation commands fail, ensure you have administrator/root privileges.
- Windows PATH Problems: If Git commands aren’t recognized after installation, make sure Git’s bin directory is added to your system’s PATH.