Installing Git and First-Time Setup
8 min read
Installing Git
Git ships with macOS Xcode Command Line Tools, is available via apt on Debian/Ubuntu, and has a Windows installer at git-scm.com. Verify your installation by running:
bash
git --version
# git version 2.44.0First-Time Global Config
Before your first commit, tell Git who you are. This information is baked into every commit you create and cannot be changed without rewriting history.
bash
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global core.editor "code --wait" # VS Code as default editor
git config --global init.defaultBranch mainThe --global flag writes to ~/.gitconfig, applying these settings to every repository on your machine. You can override them per-project by omitting --global inside a repo.
Verify Your Config
bash
git config --list --show-originUse your real name and the email address linked to your GitHub account. Mismatched emails mean your commits won't appear in your GitHub contribution graph.
Ready to test yourself?
Practice Git & GitHub— quiz & coding exercises