Skip to main content
⚡ OpenDevDocs
Git
gitgitGuideBeginner

Git Configuration (git config)

Setting up user name, email, default branch (main), core editor, credential helper, and global vs local configuration scopes.

Verified: 2026-09-30
Platforms:
all
#git#config#setup#author#editor

Git Configuration (git config)

Before making your first commit, you must configure your identity. Git embeds your author name and email into every commit you create.


1. Setting User Identity

# Set your display name:
git config --global user.name "Your Name"

# Set your email (must match your GitHub registered email):
git config --global user.email "your.email@example.com"

# Set default initial branch name to 'main':
git config --global init.defaultBranch main

# Set default text editor (e.g. VS Code, nano, or vim):
git config --global core.editor "code --wait"

# Configure pull behavior to prevent merge commits by default:
git config --global pull.rebase true

# Enable automatic colored CLI output:
git config --global color.ui auto

3. Configuration Scopes

ScopeFlagConfig File LocationPrecedence
System--system/etc/gitconfigLowest (system-wide for all users)
Global--global~/.gitconfigStandard (applies to all your repositories)
Local--local.git/config (in repo root)Highest (overrides global settings for current repo)

Viewing All Active Configurations:

git config --list --show-origin

On this page