Time to get Git installed and configured on your computer! Don't worry—this is easier than it looks.
Option 1: Official Git for Windows
- Go to git-scm.com
- Click "Download for Windows"
- Run the installer with default settings
- This includes Git Bash (a terminal for Git commands)
Option 2: GitHub Desktop (Beginner-Friendly)
- Go to desktop.github.com
- Download and install
- Includes Git automatically + nice visual interface
Option 1: Homebrew (Recommended)
# Install Homebrew first if you don't have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Git
brew install gitOption 2: Xcode Command Line Tools
xcode-select --installOption 3: Official Installer
- Go to git-scm.com
- Download Mac version
- Install normally
Ubuntu/Debian:
sudo apt update
sudo apt install gitCentOS/RHEL/Fedora:
# CentOS/RHEL
sudo yum install git
# Fedora
sudo dnf install gitOpen your terminal/command prompt and type:
git --versionYou should see something like:
git version 2.40.0
If you see this, congratulations! Git is installed! 🎉
Git needs to know who you are before you can make commits. Let's set that up:
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"Important: Use the same email address you'll use for GitHub!
git config --global user.name "Alex Smith"
git config --global user.email "alex.smith@email.com"Modern Git uses main instead of master:
git config --global init.defaultBranch mainGit sometimes opens a text editor. Set your preference:
# Visual Studio Code
git config --global core.editor "code --wait"
# Nano (simple, built-in)
git config --global core.editor "nano"
# Vim
git config --global core.editor "vim"Check that everything is set up correctly:
git config --list --globalYou should see:
user.name=Your Full Name
user.email=your.email@example.com
init.defaultbranch=main
core.editor=code --wait
Or check individual settings:
git config user.name
git config user.emailSSH keys let you connect to GitHub securely without typing your password every time.
ssh-keygen -t ed25519 -C "your.email@example.com"When prompted:
- File location: Press Enter (use default)
- Passphrase: Optional, but recommended for security
Windows (Git Bash):
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Mac/Linux:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Windows:
clip < ~/.ssh/id_ed25519.pubMac:
pbcopy < ~/.ssh/id_ed25519.pubLinux:
cat ~/.ssh/id_ed25519.pub
# Then copy the output manually- Go to GitHub.com
- Click your profile picture → Settings
- Click SSH and GPG keys
- Click New SSH key
- Paste your key and give it a title
- Click Add SSH key
ssh -T git@github.comYou should see:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
Make Git commands shorter and easier:
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.visual '!gitk'Now you can type git st instead of git status!
- Use Git Bash for Git commands (comes with Git for Windows)
- It provides a Linux-like terminal experience
- Learn these terminal basics:
pwd- show current directoryls(Mac/Linux) ordir(Windows) - list filescd folder_name- change directorycd ..- go up one directorymkdir folder_name- create directory
- Git isn't installed or not in your PATH
- Restart your terminal after installation
- On Windows, use Git Bash
- SSH key isn't set up correctly
- Make sure you added the public key to GitHub
- Check that ssh-agent is running
- Network/firewall issues
- Try HTTPS instead of SSH initially
You'll need a text editor for commit messages and file editing:
- Visual Studio Code: Free, powerful, great Git integration
- Sublime Text: Fast and simple
- Atom: GitHub's editor (discontinued but still works)
- Nano: Simple, built into most systems
- Vim: Powerful but steep learning curve
- Emacs: Feature-rich, complex
Great! Git is now installed and configured. Time to create your first repository!
Continue to Part 4: Your First Repository
Before moving on, make sure you can:
- Run
git --versionand see a version number - Run
git config user.nameand see your name - Run
git config user.emailand see your email - (Optional) Connect to GitHub via SSH
Previous: Part 2: Why Use Git? | Next: Part 4: Your First Repository