Installing & Configuring Git
Installing & Configuring Git
Section titled “Installing & Configuring Git”💻 Installing Git
Section titled “💻 Installing Git”Windows:
# Download from https://git-scm.com and run the installer# Or use winget:winget install --id Git.Git -e --source wingetmacOS:
# Via Homebrew (recommended)brew install git
# Or the official installer from https://git-scm.comLinux (Ubuntu/Debian):
sudo apt updatesudo apt install gitVerify installation:
git --version# Output example: git version 2.43.0⚙️ First-Time Configuration
Section titled “⚙️ First-Time Configuration”Git needs to know who you are. Every commit gets tagged with your name and email.
git config --global user.name "Your Name"git config --global user.email "your.email@example.com"Useful config options:
# Default branch name (instead of "master")git config --global init.defaultBranch main
# Colorful outputgit config --global color.ui auto
# Preferred text editor for commit messagesgit config --global core.editor "code --wait" # VS Code
# Line ending handling (Windows)git config --global core.autocrlf true
# View all settingsgit config --listResult: Your identity is set. Future commits will show “Your Name your.email@example.com” as the author.
🔑 SSH Keys (for GitHub)
Section titled “🔑 SSH Keys (for GitHub)”SSH keys let you push code to GitHub without typing your password every time.
1. Generate a key:
ssh-keygen -t ed25519 -C "your.email@example.com"# Press Enter to accept defaults# Optionally set a passphrase2. Start the SSH agent:
eval "$(ssh-agent -s)"ssh-add ~/.ssh/id_ed255193. Copy the public key:
cat ~/.ssh/id_ed25519.pub# Copy the entire output4. Add to GitHub:
- Go to GitHub.com → Settings → SSH and GPG keys → New SSH key
- Paste the key and save
5. Test the connection:
ssh -T git@github.com# Output: Hi username! You've successfully authenticated.Result: You can now
git pushandgit pullwithout a password prompt.
🚀 Verify Everything
Section titled “🚀 Verify Everything”# Check Git versiongit --version
# Check your identitygit config user.namegit config user.email
# Test SSH connectionssh -T git@github.comIn Simple Words
Section titled “In Simple Words”- Install Git from git-scm.com or your package manager
- Set your name and email with
git config --global— every commit needs this - Set
init.defaultBranch mainso new repos usemaininstead ofmaster - SSH keys let you connect to GitHub without typing passwords
- Always verify with
git --versionandssh -T git@github.com