MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Installing Git and Initial Configuration (git config user.name / email)0%
Study Materials
Git & GitHub BasicsProgress 0%
1.1What is Version Control? (Local, Centralized vs Distributed VCS)1.2Why Git? History, Architecture & Core Benefits1.3The Three Trees: Working Directory, Staging Area & Git Repository1.4Installing Git and Initial Configuration (git config user.name / email)
HomeTutorialsGit & GitHub BasicsInstalling Git and Initial Configuration (git config user.name / email)
Initializing a Repository (git init and .git Directory Anatomy)

Installing Git and Initial Configuration (git config user.name / email)

Beginner12 min read•Updated: 2026-09-15•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

Before creating repositories or writing commits, Git must be properly installed on your operating system and configured with your identity. Every Git commit embeds the author's name and email permanently into its cryptographic hash, making initial configuration essential.


1. Installing Git Across Operating Systems

A. Windows

  1. 1
    Download the official installer from git-scm.com (Git for Windows).
  2. 2
    Run the .exe installer. Recommended installation settings:
  • Default editor: Visual Studio Code (or your preferred editor).
  • Default branch name for new repositories: main (modern standard).
  • Adjusting your PATH environment: Git from the command line and also from 3rd-party software.
  • Line ending conversions: Checkout Windows-style, commit Unix-style line endings (core.autocrlf = true).

B. macOS

On macOS, Git can be installed via Xcode Command Line Tools or Homebrew:

1# Using Homebrew (Recommended)
2brew install git
3 
4# Or trigger Apple Xcode Command Line Developer Tools
5xcode-select --install

C. Linux (Ubuntu / Debian / Fedora)

1# Ubuntu / Debian
2sudo apt update
3sudo apt install git -y
4 
5# Fedora / RHEL
6sudo dnf install git -y

Verify Installation:

Open your terminal (PowerShell, Command Prompt, macOS Terminal, or Linux Bash) and verify:

1git --version
2# Expected output: git version 2.40.0 (or newer)

2. The Three Levels of Git Configuration

Git configurations can be applied at three different scopes:

Scope FlagConfig File LocationScope of Effect
--system/etc/gitconfig (Unix) or C:\Program Files\Git\etc\gitconfig (Windows)Applies to every user and every repository on the operating system
--global~/.gitconfig or user profile .gitconfigApplies to the current operating system user across all their repos
--local.git/config inside the active repository folderApplies only to this specific project repository
Pro Tip
[!TIP] Git evaluates configurations in order of precedence: --local overrides --global, which overrides --system.

3. Essential First-Time Configurations

Step 1: Set Your Identity (Mandatory)

Git requires an author name and email address. These will be stamped onto every commit you ever create:

1# Set your full name
2git config --global user.name "Sumit Sharma"
3 
4# Set your email address (use your GitHub-associated email)
5git config --global user.email "sumit@mskinstitute.com"

Step 2: Set Default Initial Branch Name

Historically Git defaulted to master. The modern industry standard adopted by GitHub, GitLab, and the Git community is main:

1git config --global init.defaultBranch main

Step 3: Set Your Preferred Code Editor

Configure VS Code as Git's default text editor for commit messages and interactive rebasing:

1git config --global core.editor "code --wait"

Step 4: Configure Line Ending Normalization (core.autocrlf)

Operating systems handle line breaks differently: Windows uses CRLF (\r\n), while macOS and Linux use LF (\n). Without normalization, teams collaborating across Windows and Mac will experience phantom diffs on every line:

1# On Windows machines:
2git config --global core.autocrlf true
3 
4# On macOS and Linux machines:
5git config --global core.autocrlf input

4. Inspecting and Verifying Your Configuration

To review all active configuration parameters:

1# List all resolved configurations
2git config --list
3 
4# Show where each configuration setting originates
5git config --list --show-origin
6 
7# Check a single specific setting
8git config user.name
9# Output: Sumit Sharma

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
Which git config scope applies settings across all repositories for the currently logged-in user?
Question 2
What happens if a repository has a --local setting that conflicts with a --global setting?
Question 3
Why is configuring user.name and user.email mandatory in Git?
Question 4
What is the purpose of configuring core.autocrlf = true on a Windows developer workstation?
Question 5
Which command verifies the currently installed version of Git in your terminal?
Next Lesson

Initializing a Repository (git init and .git Directory Anatomy)

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
The Three Trees: Working Directory, Staging Area & Git RepositoryInitializing a Repository (git init and .git Directory Anatomy)

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master Git & GitHub Basics with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext