Lesson 2 of 15

Installing Git & Setup

Installing Git

Git is available for Windows, macOS, and Linux. Download it from git-scm.com or use a package manager.

Example
# Check if Git is installed
git --version

# macOS (with Homebrew)
brew install git

# Ubuntu/Debian
sudo apt install git

# Windows: Download from git-scm.com

Initial Configuration

After installing Git, configure your name and email. These are attached to every commit you make.

Example
# Set your name
git config --global user.name "Your Name"

# Set your email
git config --global user.email "you@example.com"

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

# Set default editor
git config --global core.editor "code --wait"

# View all settings
git config --list

SSH Key Setup

SSH keys let you authenticate with GitHub without entering your password each time.

Example
# Generate SSH key
ssh-keygen -t ed25519 -C "you@example.com"

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

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

# Copy public key (add to GitHub Settings > SSH Keys)
cat ~/.ssh/id_ed25519.pub

# Test connection
ssh -T git@github.com