Installing Git¶
Before we can start using Git, we need to install it on your system. This guide covers installation for Windows, macOS, and Linux.
Check if Git is Already Installed¶
First, let's check if you already have Git installed on your system:
If Git is installed, you'll see output like:
If Git is not installed, you'll see an error message, and you'll need to install it using the instructions below.
Installation by Operating System¶
Windows 🪟¶
- Download Git for Windows
- Visit the official Git website: https://git-scm.com/download/win
-
Click the "Download" button to get the latest version
-
Run the Installer
- Run the downloaded
.exe
file - Follow the installation wizard with recommended settings
-
Important: Git for Windows includes Git Bash, which provides a Linux-like terminal environment
-
Verify Installation
- Open Command Prompt, PowerShell, or Git Bash
- Run
git --version
to confirm installation
Git Bash Recommendation
Git Bash provides a consistent command-line experience across different operating systems. It's especially useful if you're learning Git commands that work the same way on Linux and macOS.
macOS 🍎¶
Option 1: Download from Official Website¶
- Visit https://git-scm.com/download/mac
- Download the installer for your macOS version
- Run the installer and follow the instructions
Option 2: Using Homebrew (Recommended)¶
If you have Homebrew installed:
Option 3: Using Xcode Command Line Tools¶
Git comes bundled with Xcode Command Line Tools:
Linux 🐧¶
The installation method depends on your Linux distribution:
Ubuntu/Debian¶
Fedora¶
CentOS/RHEL¶
Arch Linux¶
Verify Your Installation¶
After installation, verify that Git is working correctly:
You should see:
- The Git version number
- Help information if you run git help
Troubleshooting Installation Issues¶
Command Not Found¶
If you get a "command not found" error:
- Restart your terminal after installation
- Check your PATH: Make sure Git's installation directory is in your system PATH
- Reinstall Git following the instructions above
Permission Issues (Linux/macOS)¶
If you encounter permission issues:
Windows-Specific Issues¶
- Make sure you're using the correct terminal (Command Prompt, PowerShell, or Git Bash)
- Try running as Administrator if you encounter permission issues
- Verify that Git was added to your system PATH during installation
Next Steps¶
Great! Now that you have Git installed, let's move on to configuring Git for first-time use.
Still Having Issues?
If you're still having trouble with installation, check our troubleshooting guide or consult the official Git documentation.