Windows — Install Git (step by step)
Option A — Easiest (official installer)
- Download
- Go to: https://git-scm.com/download/win (downloads start automatically).
- You’ll get something like
Git-<version>-64-bit.exe.
- Run the installer
- Double-click the
.exe. -
When the wizard asks:
- Adjusting your PATH → choose “Git from the command line and also from 3rd-party software”.
- Default editor → choose Vim (default) or pick Notepad++/VS Code if you prefer.
- Let Git decide line endings → choose “Checkout Windows-style, commit Unix-style (recommended)”.
- Git Credential Manager → Enable (recommended).
- SSH executable → Use bundled OpenSSH.
- Terminal emulator → Use Windows’ default console (or MinTTY if you like).
- Enable file system caching → Yes.
- Leave other defaults unless you know you need something else.
- Verify installation
-
Open Command Prompt or PowerShell and run:
git --versionYou should see a version number.
- Configure your identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
-
(Optional but recommended) Set default branch name to
main
git config --global init.defaultBranch main
- (Optional) Improve credential & line ending behavior
git config --global core.autocrlf true
git config --global credential.helper manager
- (Optional) Install Git LFS (for large files)
-
Re-run the Git installer and tick Git LFS, or:
winget install Git.GitLFS git lfs install
Option B — Using Winget (built-in on modern Windows 10/11)
winget install --id Git.Git -e
git --version
Option C — Using Chocolatey (if you already use choco)
choco install git -y
git --version
macOS — Install Git (step by step)
Option A — Using Homebrew (recommended if you already use brew)
- Install Homebrew (if you don’t have it)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
- Install Git
brew install git
git --version
Option B — Xcode Command Line Tools (no Homebrew needed)
- Run:
xcode-select --install
- In the popup, choose Install.
- Verify:
git --version
Option C — Official macOS installer
- Download the latest
.pkgfrom https://git-scm.com/download/mac - Open the
.pkg→ follow the prompts. - Verify:
git --version
Configure Git on macOS
- Identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
- Default branch
git config --global init.defaultBranch main
- Credentials stored in Keychain
git config --global credential.helper osxkeychain
One-time SSH setup (Windows & macOS)
Use this if you’ll push to GitHub/GitLab/Bitbucket over SSH (recommended for fewer password prompts).
- Generate a key (ed25519)
ssh-keygen -t ed25519 -C "you@example.com"
- Press Enter to accept default location (
~/.ssh/id_ed25519). - Optionally set a passphrase.
- Start the SSH agent & add your key
-
macOS (zsh/bash):
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 -
Windows PowerShell (Git Bash similar):
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519
- Copy your public key
-
macOS:
pbcopy < ~/.ssh/id_ed25519.pub -
Windows (PowerShell):
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard
- Add to your Git host
- GitHub: Settings → SSH and GPG keys → New SSH key → paste → Save.
- GitLab/Bitbucket: similar path under SSH Keys.
- Test
ssh -T git@github.com
You should see a success message (first time may ask to trust the host).
Quick sanity test (both platforms)
mkdir git-test && cd git-test
git init
echo "hello" > README.md
git add README.md
git commit -m "first commit"
git log --oneline
Keeping Git up to date
- Windows (winget):
winget upgrade Git.Git
-
Windows (installer): download/run the newest
.exefrom git-scm.com; it upgrades in place. - macOS (Homebrew):
brew upgrade git
-
macOS (Xcode CLT):
- Run
softwareupdate --all --install --forceor reinstall CLT withxcode-select --install.
- Run
Common issues & fixes
-
git: command not found- Windows: close/reopen terminal; ensure Git is on PATH (re-run installer and select PATH option).
- macOS: install via
xcode-select --installorbrew install git.
Corporate proxy blocks
Configure Git to use your proxy:
git config --global http.proxy http://USER:PASS@proxy.company.com:8080
git config --global https.proxy http://USER:PASS@proxy.company.com:8080
- Permission denied (publickey) Your SSH key isn’t added or not uploaded to Git host. Re-run the SSH steps above and test with:
ssh -T git@github.com
- Multiple Git versions on macOS Check which Git runs:
which git
Prefer Homebrew Git (/usr/local/bin/git on Intel, /opt/homebrew/bin/git on Apple Silicon). If needed, adjust your shell PATH to put Homebrew first.
Top comments (0)