Installing & Configuring Git
Installing Git
On your real machine, install git using your operating system's package manager:
macOS
brew install git
Or install Xcode Command Line Tools: xcode-select --install
Windows
Download the installer from git-scm.com — it includes Git Bash, a terminal that runs git commands.
Linux (Debian/Ubuntu)
sudo apt update && sudo apt install git
After installing, verify with:
git --version
Configuring Your Identity
Before making any commits, you must tell git who you are. Git attaches your name and email to every commit you create — it's like a signature on your work.
git config --global user.name "Your Name" git config --global user.email "you@example.com"
The --global flag saves these settings for all repositories on your machine, so you only need to do this once.
Why does this matter? When you push code to GitHub or collaborate with a team, every commit shows who made it. Without a name and email, git will complain before your first commit.
Checking Your Configuration
You can read back a config value at any time:
git config --global user.name git config --global user.email
Or list everything git knows about you:
git config --list
Other Useful Config Settings
These are optional but commonly used:
git config --global core.editor "code --wait" # use VS Code as editor git config --global init.defaultBranch main # use "main" not "master"
The simulator on the right supports
git config --global user.name and git config --global user.email — try setting them now. It won't affect your real machine.
Your Challenges
Set your global username:
git config --global user.name "YourName"
Set your global email:
git config --global user.email "you@example.com"
Verify your name is saved:
git config --global user.name
student@git-mastery: ~