Theory
Theory: Identity and Config are Data, Not Login
Git does not have accounts. It has key-value config and author strings baked into commits. A forge later matches those strings to a user.
Invariants
- Config is three layers: system (
/etc/gitconfig), global (~/.gitconfig), local (.git/config). Later overrides earlier. user.nameanduser.emailare copied into every commit object. Changing config does not rewrite old commits.- Authentication to a remote (SSH key or HTTPS token) is separate from commit identity.
init.defaultBranchonly affects new repositories.
/etc/gitconfig machine
~/.gitconfig you
.git/config this repo ← wins
user.email ──► commit.author (history)
SSH key ──► git@host (transport)
Why layers
One person, two emails (home and work) is a local or includeIf problem, not a second Git install. One laptop, several forges, is several keys in ~/.ssh/config, not several user.names.
What can break
- Commits with
$USER@$HOSTNAMEbecause identity was never set (user.useConfigOnlyrefuses that). - Pushing with HTTPS using an account password; most forges want a token.
- Setting
core.autocrlfon Linux and fighting LF files. - Assuming
core.editoris optional and then hanging invimongit commitwith no-m.
How to read this chapter
Install is PATH and version. Layers are which file won (--show-origin). Identity is what history will say. SSH vs HTTPS is how a remote will know you. Editor, aliases, and updates are the Linux daily driver.