Identity, Email, and Essential Settings

Updated

October 30, 2026

Identity, Email, and Essential Settings

After this page every commit you make records a name and email you chose.

Identity is metadata, not a login

user.name and user.email are written into every commit. They are not a password and not a forge account. Forges match the email to an account when they display history. A typo produces “unknown author” on the website. git commit still succeeds.

~/.gitconfig
  user.name  = Ada Desk
  user.email = ada@example.com
           │
           ▼
      commit object
        tree    …
        parent  …
        author  Ada Desk <ada@example.com>  1774… +0530
        committer Ada Desk <ada@example.com> …
        message …
git config --global user.name "Ada Desk"
git config --global user.email "ada@example.com"

Use the email the forge should associate with you. For a first laptop, any address you control is fine. For work, the company address, often via includeIf from the previous page.

Refuse to commit if identity is missing, instead of guessing $USER@$HOSTNAME:

git config --global user.useConfigOnly true

Check what will be recorded

git config user.name
git config user.email
git config --show-origin user.email

After you have a commit (chapter 3):

git log -1 --format=full

Author: is user.name <user.email> from the time of the commit. Changing ~/.gitconfig later does not rewrite old commits. Chapter 6 is amending; chapter 20 is signing.

Signing is later

Signed commits (SSH or GPG) prove the commit came from a key you hold. Set identity here first. Signing is chapter 20.

Author vs committer

A commit has two people fields: author (who wrote the patch) and committer (who made the commit object). They match until you cherry-pick, rebase, or apply a patch from someone else. git log shows the author by default. You do not need to set GIT_COMMITTER_NAME for Part I.

Essential settings, one list

If you jumped here from install, this is the whole global block this book expects:

git config --global user.name "Ada Desk"
git config --global user.email "ada@example.com"
git config --global user.useConfigOnly true
git config --global init.defaultBranch main
git config --global core.editor "nvim"
git config --global pull.ff only

Replace the name, email, and editor with yours. Then pick SSH or HTTPS on the next page.