Installing and Configuring Git
You'll learn how to get Git running on your machine and tell it who you are so every change you make is properly attributed.
Why Configure Git?
Git needs to know who's making changes because version control is fundamentally about tracking what changed and who changed it. Think of it like signing a guest book at an event—without your name, there's no record of your contribution.
Installing Git
The installation process varies by operating system:
- Linux: Use your package manager (
sudo apt install giton Ubuntu/Debian,sudo yum install giton Fedora/CentOS) - macOS: Install via Homebrew (
brew install git) or download from git-scm.com - Windows: Download the installer from git-scm.com, which includes Git Bash for command-line access
After installation, verify it worked by opening a terminal and running:
git --version
You should see output like git version 2.x.x.
Configuring Your Identity
Before making any commits, configure your name and email address. These appear in every commit you create, forming part of the permanent project history:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
The --global flag means these settings apply to all repositories on your system. You can override them per-project by running the same commands without --global inside a specific repository.
To verify your configuration:
git config --list
Why This Matters
Without proper configuration, Git will either refuse to let you commit or use default values that don't identify you correctly. This makes collaboration confusing and creates attribution problems in shared projects.
Key Takeaway: Installing Git and configuring your identity with user.name and user.email are essential first steps that ensure your contributions are properly tracked and attributed in the version history.