🌱 Phase 1 · Foundations 🟢 Beginner MODULE 02

Installing & Configuring Git

⏱️ 30 min
🛠️ Setup + Config
🧩 5 Quiz Questions
🏗️ 1 Challenge
Course progress22%
🎯 What you'll learn: How to install Git on Windows, Mac, and Linux; how to verify the installation; how to configure your identity; how to set up SSH keys for GitHub; and the essential global settings every developer should configure.

Installing Git

Git must be installed on your computer before you can use it. The installation process varies slightly by operating system but takes about 5 minutes on any platform.

🪟 Windows

1
Download Git for Windows
Go to git-scm.com and click "Download for Windows". This installs Git Bash — a terminal emulator that lets you use Git commands on Windows.
2
Run the installer
Run the .exe file. For most options, keep the defaults. When asked about the default editor, choose VS Code if installed. When asked about line endings, choose "Checkout Windows-style, commit Unix-style".
3
Verify installation
Open Git Bash (or Command Prompt) and run: git --version. You should see something like git version 2.43.0.windows.1.

🍎 Mac

1
Option A — Xcode Command Line Tools (easiest)
Open Terminal and type git --version. If Git isn't installed, macOS will prompt you to install Xcode Command Line Tools which includes Git. Click Install.
2
Option B — Homebrew (recommended for developers)
Install Homebrew first: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". Then run: brew install git.
3
Verify
In Terminal: git --version. Should show version 2.x.x.

🐧 Linux (Ubuntu/Debian)

Terminal — Ubuntu/Debian
BASH
# Update package list
sudo apt update

# Install Git
sudo apt install git

# Verify
git --version
Expected output
After running git --version, you should see something like git version 2.43.0. Any version 2.x.x is fine. If you see "command not found", the installation didn't work — try again.

Configuring Your Identity

Before making your first commit, you must tell Git who you are. This information is attached to every commit you make — it's how collaborators know who made which changes.

Terminal — Configure Git Identity
BASH
# Set your name (use your real name)
git config --global user.name "Your Full Name"

# Set your email (use the SAME email as GitHub)
git config --global user.email "you@example.com"

# Set VS Code as the default editor
git config --global core.editor "code --wait"

# Set main as the default branch name
git config --global init.defaultBranch main

# View all your settings
git config --list
⚠️
Use the same email as GitHub
The email in your Git config must match your GitHub account email. If they don't match, your commits won't be linked to your GitHub profile and your contribution graph won't show activity.

Understanding --global

The --global flag sets these values for all repositories on your computer. You can also set config per-repository (without --global) which overrides the global setting for just that project — useful if you have work and personal accounts.

Useful global settings
BASH
# Enable colored output in terminal
git config --global color.ui auto

# Windows: fix line-ending issues
git config --global core.autocrlf true

# Mac/Linux: fix line-ending issues
git config --global core.autocrlf input

# Set pull behavior (rebase instead of merge)
git config --global pull.rebase false

# Cache credentials for 1 hour
git config --global credential.helper cache

Creating a GitHub Account

GitHub is where you'll store your repositories online, collaborate with others, and build your public developer portfolio.

1
Go to github.com
Click "Sign up" in the top right. Choose a professional username — this will be in your portfolio URL (github.com/yourusername). Avoid numbers or unprofessional names.
2
Verify your email
GitHub requires email verification. Check your inbox and click the verification link.
3
Set up your profile
Add a profile photo, bio, location, and website. A complete profile looks professional. Go to Settings → Profile.
4
Choose a plan
The free plan is excellent. GitHub Free includes unlimited public and private repositories, GitHub Actions minutes, and Pages hosting.
💡
Choose your username carefully
Your GitHub username is permanent (technically changeable but discouraged). Make it: short, professional, ideally your real name or a consistent developer handle. Many employers literally Google "YourName GitHub" — make a good first impression.

Setting Up SSH Keys

SSH keys let you push to GitHub without typing your password every time. It's a public/private key pair — GitHub stores the public key, you keep the private key.

Generate an SSH Key

Terminal — Generate SSH Key
BASH
# Generate a new SSH key (use your GitHub email)
ssh-keygen -t ed25519 -C "you@example.com"

# Press Enter to accept default file location
# Enter a passphrase (optional but recommended)

# Start the SSH agent
eval "$(ssh-agent -s)"

# Add your private key to the agent
ssh-add ~/.ssh/id_ed25519

# Copy your PUBLIC key to clipboard
cat ~/.ssh/id_ed25519.pub
# (Copy the output — starts with "ssh-ed25519 ...")

Add the Key to GitHub

1
Go to GitHub Settings
Click your profile photo → Settings → SSH and GPG keys → New SSH key.
2
Paste your public key
Give it a title (e.g., "My Laptop"), paste the key content you copied, and click "Add SSH key".
3
Test the connection
Run: ssh -T git@github.com. You should see: "Hi username! You've successfully authenticated..."
🔐
SSH vs HTTPS
SSH: Uses keys — no password needed after setup. Preferred by professionals. URLs look like git@github.com:user/repo.git.
HTTPS: Easier initial setup, uses GitHub Personal Access Tokens (PAT) for auth. URLs look like https://github.com/user/repo.git. Both work — SSH is more convenient long-term.

Verify Your Full Setup

Run through this checklist to confirm everything is working before moving to the next lesson:

Setup Verification Checklist
BASH
# 1. Git version
git --version
# Expected: git version 2.x.x

# 2. Your config
git config --list
# Should show user.name, user.email, etc.

# 3. SSH connection to GitHub
ssh -T git@github.com
# Expected: Hi yourusername! You've successfully authenticated

# 4. Check specific config values
git config user.name
git config user.email
✅ Setup Checklist
git --version returns a version number
git config user.name returns your name
git config user.email returns your email
GitHub account created and email verified
SSH key added to GitHub and connection tested
🧩 Knowledge Check — Lesson 2
Test your Git setup knowledge. 5 questions with instant feedback.
1. Which command verifies Git is installed correctly?
2. What does the --global flag do in git config --global user.name?
3. Why must your Git email match your GitHub email?
4. What type of SSH key is recommended for GitHub in 2024?
5. Which command shows all your current Git configuration settings?
⚙️
Setup Challenge — Lesson 2
Real machine setup · Beginner
Challenge: Complete Git Setup & Share Your Config

1. Install Git on your machine (if not already done)
2. Configure your name and email with --global
3. Create a GitHub account (if you don't have one)
4. Set up SSH keys and test with ssh -T git@github.com
5. Run git config --list and check that your name and email appear

Bonus: Copy the output of git config --list (you can omit your email if privacy is a concern) and paste it into the course Discord or share with a study buddy to verify your setup.
💡 Show hints
  • Windows: Download from git-scm.com. Mac: try brew install git. Linux: sudo apt install git
  • Run ssh-keygen -t ed25519 -C "your@email.com" to generate keys
  • Add the key from ~/.ssh/id_ed25519.pub to GitHub → Settings → SSH keys
  • Use ssh -T git@github.com to verify the connection works
Finished this lesson?
Mark it complete to track your progress.
🎉

Lesson 2 Complete!

Git is installed and configured. You have a GitHub account. Time to make your first repository!

Lesson 02 of 09Git & GitHub Mastery