Master Git and GitHub in just 5 days Lesson 2 of 7

Git Installation & Setup

Free preview — first two lessons of this course.

Register and unlock the full course to read every chapter and track progress in your learning hub.

In this chapter, we will install Git, configure Git for the first time, understand Git setup workflow, and create our first local repository step by step.

In This Chapter You Will Learn

  • How to Install Git
  • Git Setup for Windows
  • Verify Git Installation
  • Configure Username & Email
  • What is Git Bash?
  • Create First Git Repository
  • Initialize Repository using git init
  • Understanding Hidden .git Folder
  • Basic Git Commands
  • Real Developer Workflow

What is Git Installation?

Before using Git commands, we must install Git software on our computer.

Git provides command-line tools that help developers track and manage project changes.

Simple Definition:
Git installation allows developers to use Git commands locally on their machine.

Download Git

You can download Git from the official Git website.

Official Website:
https://git-scm.com/

Git Installation Flow

Download Git
Install Git
Configure Git
Verify Installation
Start Using Git

How to Verify Git Installation?

After installation, open Git Bash or terminal and run:


git --version

Example Output


git version 2.45.0
Important:
If Git version appears, installation was successful.

What is Git Bash?

Git Bash is a terminal application provided by Git for Windows users.

It allows developers to run Git commands using Linux-style terminal commands.

Tool Purpose
Git Bash Run Git commands
Terminal Execute command-line operations
Command Prompt Alternative command tool

Configure Git Username

Git stores developer information inside commits.

We must configure username and email before creating commits.


git config --global user.name "Your Name"

git config --global user.email "yourmail@gmail.com"

Why Git Configuration is Important?

Git Commit Information

Developer makes changes

Git saves commit

Username & Email stored inside commit history

Team can identify who changed the code

Check Git Configuration

To view configured username and email:


git config --list

Create First Git Repository

A repository is a storage area where Git tracks project files and history.

Create a new project folder and initialize Git.


mkdir MyProject

cd MyProject

git init

Output


Initialized empty Git repository
Simple Definition:
git init converts a normal folder into a Git repository.

What Happens Internally in git init?

When we run git init, Git creates a hidden folder called .git inside the project.

This folder stores complete Git history, commits, branches, and configurations.

git init Internal Flow

Project Folder

git init command executes

.git hidden folder created

Git starts tracking project

Understanding .git Folder

Folder/File Purpose
objects Stores Git data
refs Stores branches
HEAD Current branch pointer
config Git configuration

Basic Git Workflow

Create File
git add
git commit
Save History

Create Your First Commit


git add .

git commit -m "First Commit"

Explanation

  • git add . → Adds files into staging area
  • git commit → Saves snapshot permanently

Most Common Beginner Mistakes

Mistake Correct Understanding
Skipping Git configuration Username & email are required
Running commands outside folder Navigate into project folder first
Confusing Git with GitHub Git works locally, GitHub works online
Forgetting git init Repository must be initialized

Real Company Workflow

Professional Workflow

Developer installs Git

Clones company repository

Creates new feature

Commits changes

Pushes code to GitHub

Most Asked Interview Questions

1. What is git init?
git init initializes a new Git repository.

2. What is Git Bash?
Git Bash is a terminal application used to run Git commands.

3. Why configure username and email?
Git stores developer information inside commits.

4. What is .git folder?
Hidden folder storing Git history and repository data.

5. How to check Git version?
Using git --version command.

Quick Revision Table

Command Purpose
git --version Check Git installation
git config Configure developer info
git init Create repository
git add . Add files for commit
git commit Save project snapshot

Conclusion

In this chapter, we learned Git installation, Git configuration, repository creation, and basic setup workflow.

These concepts are foundational for all future Git operations and professional development workflows.

In the next chapter, we will learn Git Add, Commit, Status, and Log commands deeply with real examples.

Back to course overview