git config
Set the identity and behaviour Git uses when you commit.
git configWhat it does
git config reads and writes key/value pairs across three scopes: system (whole machine), global (your user), and local (this repository). Commits are stamped with the user.name and user.email from the most local scope that has them.
Config values cascade system → global → local
Watch it — press play
A narrated, step-by-step walkthrough that shows how to do it — not just theory. It adapts to the learner mode you picked in the top bar.
Step 1
Set your name
Before your first commit, Git needs an identity — the name and email written into every commit you make.
git config --global user.name "Your Name"Identity lives in git config, applied from the narrowest scope
Under the hood
Three scopes, one merged result
Values cascade from wide → narrow. When Git needs a value, it checks local, then global, then system, and uses the first one found.
/etc/gitconfig ← system (--system) ~/.gitconfig ← global (--global) .git/config ← local (this repo)
Written as INI text files
The configuration is just human-readable text. Setting a value appends a section and key to the appropriate file.
[user] name = Ada Lovelace email = ada@example.com
Commits read it at creation time
When you commit, Git bakes the resolved user.name and user.email directly into the commit object as author and committer lines. That's why old commits keep their identity even if you change config later.
Aliases the pros type
Memorize the git config concept, then let one of these shortcuts make it instant. Aliases are real git config keys — add one with:
git config --global alias.st # → git config --globalg cfgit config --globalShorthand for global config edits.
g cglgit config --global --listDump every configured alias and setting.
Command anatomy
--globalWrite to ~/.gitconfig (your user, all repos).
--localWrite to this repository only (default).
--listPrint the fully resolved config, aliases included.
alias.<name>Create a shortcut: git config --global alias.co checkout.
When to reach for it
Just installed Git and must set user.name and user.email before your first commit.
You want to define aliases once that work in every repository.
You have two identities (work vs personal) and pin one per repo with --local.
Pro tip
See every alias you've ever defined (including the ones the site suggests) with `git config --global --get-regexp ^alias`.