Setup Git
Install and configure Git on your computer - step by step
Setup Git on Your Computer
Let's install Git and get you ready to contribute! Don't worry - we'll go through this step by step.
What is Git?
Git is a tool that helps you track changes in your code. Think of it like a "save game" feature for your projects - you can save your progress and go back to any previous version!
🖥️ Choose Your Operating System
Click on your computer's operating system below:
Windows Installation
Download Git for Windows
- Go to git-scm.com/download/win
- The download should start automatically
- If not, click "Click here to download manually"
File Size
The file is about 50 MB. It should download in a few minutes.
Run the Installer
- Find the downloaded file (usually in your Downloads folder)
- Double-click
Git-2.x.x-64-bit.exe - Click "Yes" if Windows asks for permission
Installation Wizard
Follow these steps in the installer:
Screen 1: License
- Click "Next"
Screen 2: Installation Location
- Keep the default location
- Click "Next"
Screen 3: Components
- Keep all checkboxes as they are
- Click "Next"
Screen 4: Start Menu Folder
- Keep the default
- Click "Next"
Screen 5: Default Editor
- Choose "Use Visual Studio Code" (if you have it)
- Or keep "Use Vim" (we'll change this later)
- Click "Next"
Screen 6-10: Other Settings
- Keep all defaults
- Click "Next" for each screen
Final Screen
- Click "Install"
- Wait for installation (takes 1-2 minutes)
- Click "Finish"
Verify Installation
- Press
Windows Key + R - Type
cmdand press Enter - In the black window, type:
git --version - You should see something like:
git version 2.42.0
Success!
If you see a version number, Git is installed correctly! 🎉
macOS Installation
Check if Git is Already Installed
- Open "Terminal" (press
Cmd + Space, type "Terminal", press Enter) - Type this command and press Enter:
git --version
If you see a version number:
- Git is already installed! Skip to Configure Git
If you see "command not found":
- Continue with the installation below
Install Using Homebrew (Recommended)
First, install Homebrew if you don't have it:
- Open Terminal
- Copy and paste this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Press Enter and follow the prompts
- Enter your password when asked (you won't see it typing - that's normal!)
Then install Git:
brew install gitAlternative: Install from Website
If you don't want to use Homebrew:
- Go to git-scm.com/download/mac
- Download the installer
- Open the downloaded
.dmgfile - Follow the installation wizard
Verify Installation
In Terminal, type:
git --versionYou should see something like: git version 2.42.0
Linux Installation
Check if Git is Already Installed
Open Terminal and type:
git --versionIf you see a version number, Git is already installed! Skip to Configure Git
Install Git
Choose your Linux distribution:
Ubuntu / Debian:
sudo apt update
sudo apt install gitFedora:
sudo dnf install gitArch Linux:
sudo pacman -S gitopenSUSE:
sudo zypper install gitVerify Installation
git --version⚙️ Configure Git
Now let's tell Git who you are. This information will appear on your contributions.
Set Your Name
Open Terminal (or Command Prompt on Windows) and type:
git config --global user.name "Your Name"Replace "Your Name" with your actual name!
Example:
git config --global user.name "Emma Johnson"Set Your Email
git config --global user.email "your.email@example.com"Use the same email you used for GitHub!
Example:
git config --global user.email "emma.johnson@gmail.com"Important
Use the same email address you used to sign up for GitHub. This connects your commits to your GitHub account!
Set Default Branch Name
git config --global init.defaultBranch mainThis sets "main" as the default branch name (GitHub's standard).
Set Default Editor (Optional)
If you have VS Code installed:
git config --global core.editor "code --wait"If you have Nano (simpler):
git config --global core.editor "nano"Verify Your Configuration
Check that everything is set correctly:
git config --listYou should see your name and email in the output.
🔐 Connect Git to GitHub
Now let's connect your computer to your GitHub account using SSH keys (a secure way to authenticate).
What are SSH Keys?
SSH keys are like a special password that proves your computer is allowed to access your GitHub account. It's more secure than typing your password every time!
Check for Existing SSH Keys
ls -al ~/.sshIf you see files named id_rsa.pub or id_ed25519.pub, you already have SSH keys! Skip to step 3.
Generate New SSH Key
Copy and paste this command (replace the email with yours):
ssh-keygen -t ed25519 -C "your.email@example.com"When prompted:
- "Enter file to save the key": Just press Enter (use default)
- "Enter passphrase": Press Enter (no passphrase) or type a password
- "Enter same passphrase again": Press Enter again or retype password
Created!
You should see a message saying "Your public key has been saved"
Copy Your SSH Key
On macOS:
pbcopy < ~/.ssh/id_ed25519.pubOn Linux:
cat ~/.ssh/id_ed25519.pubThen select and copy the output (Ctrl+Shift+C)
On Windows:
clip < ~/.ssh/id_ed25519.pubAdd SSH Key to GitHub
- Go to github.com and log in
- Click your profile picture (top right)
- Click "Settings"
- Click "SSH and GPG keys" (left sidebar)
- Click "New SSH key" (green button)
- Give it a title (like "My Laptop")
- Paste your key in the "Key" field
- Click "Add SSH key"
Test the Connection
ssh -T git@github.comYou might see a warning about authenticity. Type yes and press Enter.
Success looks like:
Hi YourUsername! You've successfully authenticated...🎉 You're All Set!
Congratulations!
Git is installed and configured! You're ready to start contributing to open source!
What You've Accomplished
✅ Installed Git on your computer
✅ Configured your name and email
✅ Connected to GitHub with SSH
✅ Ready to make your first contribution!
🆘 Troubleshooting
"git: command not found"
Solution:
- Make sure Git is installed
- Restart your terminal
- On Windows, make sure you're using Git Bash
"Permission denied (publickey)"
Solution:
- Make sure you copied the entire SSH key
- Check that you added it to GitHub correctly
- Try generating a new SSH key
"Could not resolve hostname github.com"
Solution:
- Check your internet connection
- Try again in a few minutes
- Check if GitHub is down: githubstatus.com
Still Having Issues?
- Check GitHub's documentation
- Ask in GitHub Community
- Search for your error message on Google
📚 Useful Git Commands
Here are some commands you'll use often:
# Check Git version
git --version
# See your configuration
git config --list
# Get help
git help
# Clone a repository
git clone <url>
# Check status
git status
# Add files
git add .
# Commit changes
git commit -m "Your message"
# Push to GitHub
git push
# Pull latest changes
git pullDon't Memorize!
You don't need to memorize these now. We'll explain each command when you need it!
Next Steps
Your First PR
Now that Git is set up, make your first pull request!
Browse Issues
Find something to work on
Learn Git Basics
Understand Git commands
Join Community
Get help from others
🎊 Great job setting up Git! You're one step closer to your first contribution!