1 min read

Git Configuration Guide

After installing Git, the first step is to introduce yourself to the version control system. These settings are embedded into every commit you make.

1. Prerequisites

Ensure Git is installed on your system.

2. Identity Setup

Git needs to know who you are to attribute changes to you.

  1. Set your Name:

    git config --global user.name "Your Name"
  2. Set your Email:

    • Note: This should match the email used for your GitHub/GitLab account.
      git config --global user.email "your.email@example.com"

3. Default Branch Configuration

Historically, Git used master as the default branch name. Modern best practices and platforms like GitHub now use main.

  • Set default branch to main:
    git config --global init.defaultBranch main

4. Verification

To confirm your settings are applied correctly:

  1. Run the list command:
    git config --list
  2. Expected Output:
    user.name=Your Name
    user.email=your.email@example.com
    init.defaultbranch=main