Lesson Completion
Back to course

Installing Git

Beginner
10 minutes4.8Git

The Hook (The "Byte-Sized" Intro)

You can't drive a car you haven't built. But with Git, building takes exactly one command on any operating system. Five minutes of setup, and every project you ever touch gets a safety net, a time machine, and a collaboration superpower.

📖 What is Installing Git?

Installing Git means getting the git command available in your terminal. Git runs on macOS, Windows, and Linux — and most modern systems either have it pre-installed or make installation trivially easy.

Conceptual Clarity

  • Git is a command-line tool at its core. GUIs (like GitHub Desktop) are optional wrappers on top.
  • You install it once, globally, and it's available for every project on your machine.
  • After installation, you verify it works by checking the version.
  • Git is updated independently of your OS — keep it reasonably current for security and features.

Real-Life Analogy

Installing Git is like putting a pen in your pocket. You don't need a different pen for each notebook — one pen (Git) works across all your projects. You just need to make sure you have one.

Visual Architecture

flowchart LR A["🖥️ Choose Your OS"] --> B["📦 Install Git"] B --> C["✅ Verify: git --version"] C --> D["🚀 Ready to Use"] style A fill:#1a1a2e,stroke:#e94560,color:#e94560 style B fill:#1a1a2e,stroke:#e94560,color:#e94560 style C fill:#0f3460,stroke:#53d8fb,color:#53d8fb style D fill:#0f3460,stroke:#53d8fb,color:#53d8fb

Why It Matters

  • Without Git installed, no Git command works — git init, git commit, git push — all fail.
  • Version differences can cause subtle issues. Knowing your version helps when troubleshooting.
  • Some features (like git switch, git restore) only exist in newer versions (2.23+).

Code

macOS:

bash
# Option 1: Xcode Command Line Tools (most common) xcode-select --install # Option 2: Homebrew (recommended for latest version) brew install git # Verify installation git --version # Output: git version 2.43.0

Windows:

bash
# Option 1: Download from https://git-scm.com/download/win # Run the installer with default settings # Option 2: Using winget (Windows Package Manager) winget install Git.Git # Option 3: Using Chocolatey choco install git # Verify installation (in Git Bash or PowerShell) git --version

Linux (Ubuntu/Debian):

bash
sudo apt update sudo apt install git # Verify git --version

Linux (Fedora/RHEL):

bash
sudo dnf install git # Verify git --version

Post-Installation Checklist

StepCommandWhy
Verify versiongit --versionConfirm installation worked
Check locationwhich git (mac/linux) or where git (windows)Know where Git binary lives
Update if oldUse your package manager to updateGet latest features and security fixes
bash
# Where is Git installed? which git # Output: /usr/bin/git (or /opt/homebrew/bin/git on Apple Silicon) # Is your version recent enough for modern features? # git switch and git restore require 2.23+ git --version

Key Takeaways

  • Git installs with one command on any OS.
  • Always verify with git --version after installation.
  • Use Homebrew (macOS), winget/chocolatey (Windows), or apt/dnf (Linux) for easy installation and updates.
  • Keep Git reasonably updated — newer versions add useful commands like git switch and git restore.

Interview Prep

  • Q: How do you install Git on a fresh machine? A: On macOS, use xcode-select --install or brew install git. On Ubuntu, use sudo apt install git. On Windows, download from git-scm.com or use winget install Git.Git. Verify with git --version.

  • Q: How do you check which version of Git is installed? A: Run git --version. This shows the version number. You can also run which git (mac/linux) to see where the binary is located.

  • Q: Why might the Git version matter? A: Some features like git switch and git restore were introduced in Git 2.23. Older versions may not support them. Additionally, newer versions include security patches and performance improvements.

Topics Covered

Git FundamentalsGit Introduction

Tags

#git#installation#setup#beginner-friendly

Last Updated

2026-02-12