Installing and Configuring Git
Installing Git
On macOS
# Option 1: Using Homebrew (recommended)
brew install gitOption 2: Xcode Command Line Tools
xcode-select --install
On Windows
Download from [git-scm.com](https://git-scm.com/download/win) and run the installer. Accept all defaults.On Linux (Ubuntu/Debian)
sudo apt update
sudo apt install git
Verifying Installation
git --version
Output: git version 2.43.0 (or similar)
First-Time Setup
Before using Git, tell it who you are. This information appears in every commit you make.
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Checking Your Configuration
git config --list
This shows all your Git settings.
Setting Your Default Editor
# For VS Code
git config --global core.editor "code --wait"For nano (simpler)
git config --global core.editor "nano"
Summary
| Command | Purpose |
|---|---|
git --version | Check if Git is installed |
git config --global user.name "Name" | Set your name |
git config --global user.email "email" | Set your email |
git config --list | View all settings |