Lesson 4 +10 XP

First-Time Git Config

First-Time Git Config

The very first thing you should do after installing Git is tell it who you are. Git uses this information to label your commits.

Your name and email

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

These are stored once, and Git uses them for every project you work on.

Check your settings

git config --list

This shows all your config values. To check one value:

git config user.name
git config user.email

Three levels of config

LevelFlagApplies to
System--systemevery user on the computer
Global--globalall your projects
Local--local (default)one project only

Settings in a lower level override higher ones. So a local config can use a different email for one special project.

Why it matters

Every commit records your name and email. If they are wrong, your history will look wrong too, so set them up right from the start.

TL;DR

  • Set user.name and user.email with git config --global.
  • View settings with git config --list.
  • Levels: system, global, and local (project).
  • Your commits are labeled with the name and email you configure.