2. Installing Git & First Configuration
Installing Git & First Configuration
Before any Git work, you need Git installed and configured with your identity. Every commit you make will be permanently tagged with your name and email. This is not optional.
Installation
macOS (using Homebrew):
brew install git
Ubuntu / Debian Linux:
sudo apt update && sudo apt install git
Windows: Download Git for Windows. This includes Git Bash, a Unix-style terminal for Windows.
Verify installation (Expected output: git version 2.44.0):
git --version
Essential First Configuration
Run these three commands immediately after installing Git. You only need to do this once per machine. This identity is attached to every commit you make.
Set your full name (as it will appear on every commit):
git config --global user.name "Your Full Name"
Set your email (use the same one as your GitHub account):
git config --global user.email "you@example.com"
Set VS Code as your default editor for commit messages:
git config --global core.editor "code --wait"
Verify your configuration:
git config --list
SSH Key Setup — Authenticate Without Passwords
SSH keys let you push to GitHub without typing a password every time. Generate them once and forget about authentication forever. Press Enter to accept defaults at all prompts during generation:
ssh-keygen -t ed25519 -C "you@example.com"
Copy the PUBLIC key to your clipboard.
macOS:
cat ~/.ssh/id_ed25519.pub | pbcopy
Linux:
cat ~/.ssh/id_ed25519.pub
Then copy the output. Next, go to: GitHub → Settings → SSH Keys → New SSH Key. Paste and save. You're done — no more passwords.
Test the connection (Expected: Hi username! You've successfully authenticated.):
ssh -T git@github.com
Knowledge Check
Ready to test your understanding of 2. Installing Git & First Configuration?