Initial Setup in Git

From the Git cheat sheet ยท Getting Started ยท verified Nov 2026

Initial Setup

Configure Git for first time use with your identity

bash
# Set user info (required for commits)
git config --global user.name "Your Name"
git config --global user.email "email@example.com"

# Set default branch name
git config --global init.defaultBranch main

# Check settings
git config --list
๐Ÿ’ก --global applies to all your repos (~/.gitconfig)
๐Ÿ“Œ Local config overrides global settings
โšก Set your editor for commit messages and conflicts
๐Ÿ“Œ Without init.defaultBranch, Git still uses master

Continue with Git

Save the full cheat sheet or work through every related task.

More Git tasks

Back to the full Git cheat sheet