Quick Config
What
Git associates every code change (commit) with an author’s name and email address. Before you start saving changes, you must configure this developer identity.
How
You can configure Git options at different levels (system-wide, globally for your user, or locally within a single project). Typically, you will set these options globally:
# Check if your name and email are already configured
git config --global user.name
git config --global user.email
# Configure your global developer identity
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Set 'master' (or 'main') as the default branch name for all new repositories
git config --global init.defaultBranch master
Note: In Git version 2.38 and newer, you can also use the get and set subcommands:
git config set --global user.name "Your Name"
git config get --global user.name
To verify your configuration, you can view your global config file directly:
# View all active config options
git config --list
# View the raw global config file content
cat ~/.gitconfig
Why
Git uses author identity fields to establish a clear audit trail. When collaborating on a shared project, this metadata tells other developers exactly who authored each line of code, allowing for efficient communication, code reviews, and project management.
Summary
Configure user.name and user.email globally on your machine to ensure all of your project contributions are properly attributed to your developer profile.