Introducing Yourself to Git

Git won't work with a stranger. Before it stamps a single commit, it needs to know who you are.

Imagine showing up to a job and refusing to tell anyone your name — Git feels the same way. Before it stamps a single commit, it needs to know who is responsible for the work.\n\nThis VM genuinely has git installed but genuinely no identity configured — checked directly, not assumed. In this lab you will verify git is installed, tell it your real name and email, and inspect the exact config file git uses to remember you. This takes about five minutes, and you will never have to do it again on this machine.

Why Git Needs to Know Who You Are

Before git will record a single change, it needs an identity attached to it. This isn't surveillance — it's accountability at scale. When ten engineers commit to the same repository, every commit carries a name and email so anyone can answer: "who changed this, and when?"

What git config --global Does

git config --global user.name "Ada Lovelace"
git config --global user.email "ada@example.com"

The --global flag writes your settings to ~/.gitconfig — a real file in your home directory, read by every repository on this machine. You set it once; it applies everywhere.

Config Priority

Git reads configuration from three layers, with the most specific winning:

  PRIORITY  SOURCE              SCOPE
  ────────────────────────────────────────────────
  1 (high)  .git/config         this repo only
  2         ~/.gitconfig        your user account
  3 (low)   /etc/gitconfig      entire machine

If you ever see unexpected behavior — the wrong name on a commit — run git config --list --show-origin to see exactly which real file each setting comes from.

git config

The command for reading and writing git's configuration. Settings can be scoped to a single repository, your user account (--global), or the entire machine (--system).

--global flag

Writes the setting to your user-level config file (~/.gitconfig) rather than the current repository's .git/config, so it applies to every repository you ever create or clone on this machine.

🔍 Confirm Git Is Genuinely Installed

Before anything else, make sure git is actually here. Run git --version to ask git to introduce itself.

git --version

student@lab:~$ git --version git version 2.43.5

🏷️ Set Your Name

Every commit you ever make on this machine will carry your name. Run git config --global user.name to set it.

git config --global user.name 'Ada Lovelace'

student@lab:~$ git config --global user.name 'Ada Lovelace'

📧 Set Your Email

Git also records your email with each commit. On team projects, this is how your commits link back to your GitHub/GitLab account.

git config --global user.email 'ada@example.com'

student@lab:~$ git config --global user.email 'ada@example.com'

🔎 Inspect Your Real Config

Run git config --list to see everything git genuinely knows about you.

git config --list

student@lab:~$ git config --list user.name=Ada Lovelace user.email=ada@example.com

🌍 See Where Config Actually Lives

Run git config --list --show-origin to see which real file each setting comes from.

git config --list --show-origin

student@lab:~$ git config --list --show-origin file:/home/student/.gitconfig user.name=Ada Lovelace file:/home/student/.gitconfig user.email=ada@example.com

Lab 1.1.1 complete. A real git identity, genuinely configured on a real VM:\n\n\n Git installation confirmed : ✅ real git version, checked directly\n Name configured : ✅ written to ~/.gitconfig\n Email configured : ✅ written to ~/.gitconfig\n Config inspected : ✅ --list and --show-origin both confirmed\n

Enable JavaScript to run the live terminal and track your progress.