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.
Every command in this guide is typed into a terminal — a window where you type instructions instead of clicking them.
macOS: press Cmd + Space, type Terminal, 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.
Every command in this guide and the GitHub Setup Guide works in PowerShell — they all run the git or gh program, which the installer adds to your system.
Windows: when you might want Git Bash instead. The Git installer also adds Git Bash, a terminal that behaves like the macOS one. If you follow a tutorial written for Mac or Linux — anything using ls, touch, or forward-slash paths — run it in Git Bash and the commands work unchanged. For everything in these guides, PowerShell is fine.
PowerShell says git is not recognized? Git installed without being added to your PATH. See Troubleshooting to fix it — or use Git Bash, which works either way.
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 other developer tools.
Seeing “command line tools are already installed”? That red text isn’t a problem — it means Git is already there. Skip to Verify Installation.
These screens appear in this order as you click through:
Default editor: Select VS Code or Cursor if listed. If neither appears (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
Use the email address you plan to use for your GitHub account (set up in the next step). 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.
Planning to keep your email private on GitHub? GitHub’s Keep my email addresses private setting (under Settings → Emails) gives you a substitute address ending in @users.noreply.github.com. Once your account exists, come back and run the email command again with that address:
Otherwise, if the companion setting Block command line pushes that expose my email is on, GitHub rejects pushes made with your real email (error: GH007).
Confirm your identity actually saved:
Terminal window
gitconfig--globaluser.name
gitconfig--globaluser.email
Each command prints back the value you just set. If either prints nothing, re-run the matching command above.
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)
Ask 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:
Terminal window
gitconfig--global--unsethttp.proxy
gitconfig--global--unsethttps.proxy
Behind a firewall that blocks SSH: if git clone [email protected]:... 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 Setup Guide and Repository Creation and Cloning Guide use by default.
Make sure you selected the PATH option during installation
Reinstall and select “Git from the command line and also from 3rd-party software”
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 cmd folder (typically C:\Program Files\Git\cmd) — click New and add it if missing
Click OK on every dialog, then close and reopen your terminal
Run git --version again 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?