Installing & Configuring Git
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
git --version. You should see something like git version 2.43.0.windows.1.🍎 Mac
git --version. If Git isn't installed, macOS will prompt you to install Xcode Command Line Tools which includes Git. Click Install./bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". Then run: brew install git.git --version. Should show version 2.x.x.🐧 Linux (Ubuntu/Debian)
# Update package list sudo apt update # Install Git sudo apt install git # Verify git --version
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.
# 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
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.
# 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.
github.com/yourusername). Avoid numbers or unprofessional names.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
# 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
ssh -T git@github.com. You should see: "Hi username! You've successfully authenticated..."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:
# 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
git --version returns a version numbergit config user.name returns your namegit config user.email returns your email--global flag do in git config --global user.name?1. Install Git on your machine (if not already done)
2. Configure your name and email with
--global3. Create a GitHub account (if you don't have one)
4. Set up SSH keys and test with
ssh -T git@github.com5. Run
git config --list and check that your name and email appearBonus: 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.pubto GitHub → Settings → SSH keys - Use
ssh -T git@github.comto verify the connection works