Git Configuration

3.1 Setting Up User Information

Git records the author's name and email with every commit.
Set them globally (recommended for first-time setup):

1git config --global user.name "Your Name" 2git config --global user.email "your.email@example.com"

To verify:
1git config --global --list

If you want to override these details for a specific repository only:
1git config user.name "Project Specific Name" 2git config user.email "project.email@example.com"

3.2 Configuring Default Branch Name

By default, Git may use master as the main branch. You can set a preferred default branch name like main:

1git config --global init.defaultBranch main

This ensures all new repositories start with main as the initial branch.

3.3 Setting Up the Default Editor

Git uses an editor for commit messages and rebase operations. You can configure your preferred editor:
1git config --global core.editor "code --wait" # VS Code 2git config --global core.editor "nano" # Nano 3git config --global core.editor "vim" # Vim

3.4 Enabling Color Output

Make Git command output easier to read:
1git config --global color.ui auto

3.5 Checking All Configurations

You can view all active configuration values with:
1git config --list

To see where a specific config is defined:
1git config --show-origin user.name

3.6 Editing Configuration Files Directly

Git stores configurations in text files:
System level: /etc/gitconfig
Global level: ~/.gitconfig or C:\Users\<username>\.gitconfig
Local level: .git/config inside the repository

Open .gitconfig for manual editing:
1git config --global --edit