Git Installation Guide
Prerequisite 2 of 3. You have a GitHub account and know which email address is on it. This guide installs Git on your computer and tells it who you are. The GitHub CLI comes next.
What Is Git?
Section titled “What Is Git?”Git is a version control tool — it tracks every change you make to your files over time. Think of it like a detailed undo history that never expires. You can save a snapshot of your work (called a commit), go back to any previous version, and see exactly what changed and when.
For AI development, Git is essential for two reasons. First, AI coding tools use it behind the scenes — every time an AI assistant edits a file, that change gets tracked as a commit, giving you a clear record of what the AI did and letting you undo anything you don’t want. Second, the prompts, skills, and agents you create are valuable building blocks that power your AI workflows. Git ensures you never lose them — every version is saved, and you can always recover or refine what you’ve built.
This guide installs Git on your machine and sets up your identity so your work is properly attributed.
Step 1: Open Your Terminal
Section titled “Step 1: Open Your Terminal”Every command in this guide is typed into a terminal — a window where you type instructions instead of clicking them.
- macOS: press
Cmd + Space, typeTerminal, press Enter. - Windows: press Start, type
PowerShell, press Enter.
You type a command, press Enter, and read what comes back. Never used a terminal before? The Terminal Basics primer is about 15 minutes and covers everything the guides below assume.
Step 2: Check If Git Is Already Installed
Section titled “Step 2: Check If Git Is Already Installed”Open your terminal and run:
git --version- You see a version number (e.g.,
git version 2.39.0)? Git is already installed. Skip to Step 5: Configure Your Identity. - On a Mac, a popup appears saying The “git” command requires the command line developer tools. Would you like to install the tools now? That’s not an error — it’s the installer. Click Install, wait for it to finish (10–30 minutes; the time estimate is famously unreliable), then continue to Step 4. You’ve just done Option 1 below.
- Anything else (
command not found,not recognized)? Continue to Step 3.
Step 3: Install Git
Section titled “Step 3: Install Git”Follow the section for your computer, then continue to Step 4.
Option 1: Xcode Command Line Tools (Recommended)
Section titled “Option 1: Xcode Command Line Tools (Recommended)”- In your terminal, run:
xcode-select --install - Click Install in the popup dialog
- Wait for installation to complete — the download can take 10–30 minutes, and the dialog’s time estimate is famously unreliable (it may claim hours). Let it run.
This installs Git along with Apple’s other free developer tools. (You don’t need the full Xcode app — just these command line tools.)
Seeing “command line tools are already installed”? That red text isn’t a problem — it means Git is already there. Skip to Step 4: Verify Installation.
Option 2: Homebrew
Section titled “Option 2: Homebrew”Homebrew is a popular tool for installing developer software on macOS. If you don’t have it, use Option 1 above.
brew install gitDon't have Homebrew? (not required — Option 1 is simpler)
Homebrew is a package manager some Mac users install for developer tools. If you want it anyway, follow the one-line install command at brew.sh. Two things catch people out:
- It asks for your Mac password partway through and then runs for 5–10 minutes — that’s normal.
- On an Apple Silicon Mac, the last lines of output say Next steps and show two commands to add Homebrew to your PATH. Run them. If you skip this,
brewsayscommand not foundin every new terminal.
Windows
Section titled “Windows”Download and Install
Section titled “Download and Install”- Go to git-scm.com
- Click Download for Windows
- Open your Downloads folder and double-click the file (named like
Git-2.xx-64-bit.exe). If Windows asks Do you want to allow this app to make changes?, click Yes - Click Next through the prompts — the installer shows about ten screens. On every screen except the three listed below, the default is right: just click Next
- Click Install, wait for the progress bar to finish, then click Finish
Important Settings During Install
Section titled “Important Settings During Install”These screens appear in this order as you click through:
- Default editor: Select Visual Studio Code if it’s listed. If it isn’t (you haven’t installed an editor yet), choose Notepad — you can change this later. Avoid the default (Vim) unless you’re familiar with it.
- PATH environment: Select “Git from the command line and also from 3rd-party software” — this is already the default, so just confirm it’s selected
- Line endings: Select “Checkout Windows-style, commit Unix-style line endings” — also the default
Step 4: Verify Installation
Section titled “Step 4: Verify Installation”After installing, open a new terminal window and run:
git --versionYou should see a version number confirming Git is installed.
Step 5: Configure Your Identity
Section titled “Step 5: Configure Your Identity”Set your name and email for Git commits. Replace Your Name and your.email@example.com with your own, and keep the quotation marks — without them, a name with a space in it won’t save correctly:
git config --global user.name "Your Name"git config --global user.email "your.email@example.com"Use the email address on your GitHub account — the one you wrote down in the GitHub Account guide. If they don’t match, your commits still work, but GitHub shows them under an unlinked name instead of your profile. That’s easy to fix later — add the email address to your GitHub account (Settings → Emails) and GitHub links your past commits to your profile automatically.
Turned on Keep my email addresses private on GitHub? Use the substitute @users.noreply.github.com address instead — see the GitHub Account guide for where to find it.
Confirm your identity actually saved:
git config --global user.namegit config --global user.emailEach command prints back the value you just set. If either prints nothing, re-run the matching command above.
Done When
Section titled “Done When”| Prerequisite | Done when |
|---|---|
| 2. Git installed | git --version prints a version number, and git config --global user.name and git config --global user.email each print back the value you set |
Next: Install the GitHub CLI — prerequisite 3 of 3.
Corporate Networks (Proxy / Firewall)
Section titled “Corporate Networks (Proxy / Firewall)”If Git commands work at home but fail on your work machine, your company network is the likely cause. Don’t troubleshoot this alone: ask your IT team whether your network uses a proxy, and share this section with them — the commands below are the fix, but IT has the details (like the proxy address) that make them work.
Proxy and firewall fixes (for you and your IT team)
Behind a proxy:
git config --global http.proxy http://proxy.company.com:portgit config --global https.proxy http://proxy.company.com:portAsk your IT team for the proxy address and port if you don’t have it. To remove both settings later — do unset both, or the leftover https.proxy keeps breaking HTTPS remotes once you’re off the corporate network:
git config --global --unset http.proxygit config --global --unset https.proxyBehind a firewall that blocks SSH: if git clone git@github.com:... hangs or times out, corporate firewalls often allow HTTPS (port 443) but block the SSH port. Use the HTTPS clone URL instead (https://github.com/...) — this is also what the GitHub CLI Setup Guide and Repository Creation and Cloning Guide use by default.
Troubleshooting
Section titled “Troubleshooting”Command not found (Mac)?
- Close and reopen Terminal after installation
- Try running
xcode-select --installagain
Command not found (Windows)?
- Close and reopen your terminal
- Make sure you selected the PATH option during installation
- Reinstall and select “Git from the command line and also from 3rd-party software”
- Or use Git Bash instead of PowerShell — the Git installer adds it, and it finds
giteither way. Git Bash also behaves like the macOS terminal, so tutorials written for Mac or Linux (anything usingls,touch, or forward-slash paths) work in it unchanged. For everything in these guides, PowerShell is fine.
PATH still broken after reinstalling on Windows?
- Open Start → Environment Variables (search “edit the system environment variables”)
- Click Environment Variables…
- Under System variables, select Path, click Edit
- Confirm an entry exists for Git’s
cmdfolder (typicallyC:\Program Files\Git\cmd) — click New and add it if missing - Click OK on every dialog, then close and reopen your terminal
- Run
git --versionagain to confirm
Permission errors?
- On Mac, you may need to enter your password during Xcode tools installation
- On Windows, run the installer as Administrator
Ask AI for help
If you’re stuck, paste this into ChatGPT, Claude, or Gemini:
I’m trying to install Git on [Mac / Windows] and getting this error: [paste the error message]. I followed the steps from the official guide. What should I try next?
Next Steps
Section titled “Next Steps”- Install the GitHub CLI (see GitHub CLI Setup Guide)
- Then create and clone your first repository (see Repository Creation and Cloning Guide)