Installing and Setting Up Git
Git runs on Windows, macOS, and Linux. After installation, you’ll configure your identity so Git knows who’s making changes.
Installation
Windows
Download from git-scm.com and run the installer.
macOS
brew install git
Or install Xcode Command Line Tools.
Linux
sudo apt install git # Debian/Ubuntu
sudo dnf install git # Fedora
Configuring Your Identity
Set your name and email so commits are attributed to you:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Setting Default Editor
Choose your preferred editor for commit messages:
git config --global core.editor "code --wait" # VS Code
git config --global core.editor "vim" # Vim
git config --global core.editor "nano" # Nano
Viewing Configuration
Check all your settings:
git config --list
Best Practices
- Use your real name and email for professional projects
- Set your editor to something you’re comfortable with
- Use
--globalfor system-wide settings - Use
--localfor project-specific settings
Common Mistakes
- Forgetting to set your name and email
- Using a fake email that doesn’t match your accounts
- Not setting an editor (Git will use a default you might not know)
- Installing Git without adding it to PATH