CPCODELAB
Git & GitHub

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.0

First-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 main

The --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-origin

Use 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