Installing Git
Before you can use Git you need to install it. Git is available for every major operating system, totally free. The installation adds a git command to your terminal — that one binary is the entire program. There is no separate “Git server” to install for normal use.
Check if Git is already installed
Many systems ship with Git pre-installed. Before downloading anything, check:
Check your current Git version
git --version # Example output: # git version 2.43.0
If you see a version number, Git is installed. If you see command not found or git is not recognised, you need to install it.
Quick installation by OS
Windows
The official installer is at https://git-scm.com/download/win. Download and run it. The defaults are sensible — just keep clicking Next. The installer also bundles Git Bash, a Unix-like terminal that runs the same commands documented in every Git tutorial.
Or, if you have winget (Windows 10/11):
Install Git with winget
winget install --id Git.Git -e --source winget
macOS
The easiest method is Homebrew (recommended):
Install Git on macOS
# Install Homebrew first if you don't have it /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Then install Git brew install git
Alternatively, macOS includes Apple’s build of Git via Xcode Command Line Tools. The first time you run git in a fresh terminal, macOS will offer to install them.
Linux
Use your distribution’s package manager:
Install Git on Linux
# Debian / Ubuntu sudo apt update sudo apt install git # Fedora sudo dnf install git # Arch sudo pacman -S git # Alpine apk add git
Verify the installation
After installing, open a new terminal and run:
git --version
You should see something like git version 2.43.0. If you do, Git is ready to use.
First-time setup (you only do this once per machine)
Git tags every commit with your name and email. Tell it who you are:
One-time configuration
git config --global user.name "Your Name" git config --global user.email "you@example.com" # Pick a default branch name for new repos (most teams use 'main') git config --global init.defaultBranch main # Set your preferred editor (used for commit messages) git config --global core.editor "code --wait" # VS Code # git config --global core.editor "nano" # nano # git config --global core.editor "vim" # vim # Optional: nicer log output git config --global pull.rebase false # explicit merge on pull git config --global core.autocrlf input # macOS/Linux # git config --global core.autocrlf true # Windows
You can check your config any time with:
git config --global --list
Updating Git
Windows: run the new installer; it replaces the old one.
macOS (Homebrew):
brew update && brew upgrade gitLinux: use your package manager —
sudo apt upgrade git, etc.
Uninstalling Git
If for some reason you need to remove Git:
Windows: Apps & Features → uninstall Git.
macOS (Homebrew):
brew uninstall gitLinux:
sudo apt remove git(or equivalent).
Uninstalling Git does not delete your existing repositories or their history — those live in .git folders inside your project folders. Reinstalling Git will pick them right up.