Now that you understand what Git is, why it was created, and how it differs from GitHub, it's time to install Git on your computer.
Installing Git is the first practical step toward becoming a Git user. Fortunately, the installation process is simple and only takes a few minutes.
In this article, you will learn how to install Git on Windows, macOS, and Linux, verify that the installation was successful, configure Git for the first time, and understand the purpose of the initial configuration.
By the end of this article, your computer will be fully prepared for the practical Git lessons that follow.
What is Git Installation?
Git is software, just like Java, Python, or Google Chrome.
Before using Git commands, you must install Git on your operating system.
After installation, Git provides:
Git Command Line
Git Bash (Windows)
Git GUI (optional)
Git libraries and utilities
Once installed, you can execute Git commands from the terminal or command prompt.
System Requirements
Git is lightweight and works on almost every modern computer.
Minimum requirements:
Windows 10 or Windows 11
macOS 11 or later
Linux (Ubuntu, Debian, Fedora, Arch, etc.)
At least 200 MB of free storage
Internet connection (only for downloading Git)
Installing Git on Windows
Git for Windows is the most commonly used installation package.
Step 1: Download Git
Open your web browser and visit the official Git website:
Click the Download for Windows button.
The download will start automatically.
Step 2: Run the Installer
Locate the downloaded installer.
Example:
Git-2.xx.x-64-bit.exe
Double-click the installer.
If Windows displays a security message, click Yes.
Step 3: Welcome Screen
The Git Setup Wizard opens.
Click Next.
Step 4: Choose Installation Location
The default installation location is usually:
C:\Program Files\Git
Leave it unchanged.
Click Next.
Step 5: Select Components
The default components are suitable for most users.
Recommended options include:
Git Bash
Git GUI
Windows Explorer Integration
Git LFS (optional)
Leave the default selections.
Click Next.
Step 6: Choose Default Editor
Git asks which text editor should be used.
Common choices:
Visual Studio Code (Recommended)
Notepad++
Vim
Nano
If Visual Studio Code is installed, select it.
Otherwise, keep the default editor.
Click Next.
Step 7: Initial Branch Name
Git asks for the default branch name.
Choose:
main
This is the modern standard used by most projects.
Click Next.
Step 8: PATH Environment
Choose:
Git from the command line and also from third-party software
This allows Git commands to work in:
Command Prompt
PowerShell
Git Bash
Visual Studio Code Terminal
Click Next.
Step 9: HTTPS Transport Backend
Choose:
Use the OpenSSL Library
Click Next.
Step 10: Line Ending Conversions
Recommended option:
Checkout Windows-style, commit Unix-style line endings
Click Next.
Step 11: Terminal Emulator
Select:
Use MinTTY (the default terminal of MSYS2)
Click Next.
Step 12: Default Git Pull Behavior
Choose:
Fast-forward or merge
Click Next.
Step 13: Credential Helper
Select:
Git Credential Manager
This securely stores your GitHub credentials.
Click Next.
Step 14: Additional Options
Keep the default options.
Click Install.
The installation takes about one or two minutes.
Finally, click Finish.
Congratulations! Git is now installed on Windows.
Installing Git on macOS
macOS users have multiple installation options.
Option 1: Install Using Homebrew (Recommended)
Open the Terminal and run:
brew install git
Wait for the installation to complete.
Option 2: Install Using Xcode Command Line Tools
Run:
git --version
If Git is not installed, macOS will prompt you to install the Xcode Command Line Tools.
Click Install and wait for the process to finish.
Option 3: Download Installer
Visit:
https://git-scm.com
Download the macOS installer and follow the installation wizard.
Installing Git on Linux
Most Linux distributions include Git in their package repositories.
Ubuntu / Debian
sudo apt update
sudo apt install git
Fedora
sudo dnf install git
CentOS
sudo yum install git
Arch Linux
sudo pacman -S git
Verifying the Installation
After installation, open your terminal or command prompt.
Type:
git --version
Example output:
git version 2.50.1
If you see the version number, Git has been installed successfully.
Understanding the Git Terminal
Depending on your operating system, you may use:
Windows
Git Bash
Command Prompt
PowerShell
VS Code Terminal
macOS
Terminal
VS Code Terminal
Linux
Terminal
VS Code Terminal
All of these can execute Git commands.
First-Time Git Configuration
After installing Git, you should configure your identity.
Git records the author's name and email with every commit.
Set Your Name
git config --global user.name "Your Name"
Example:
git config --global user.name "Rahul Sharma"
Set Your Email
git config --global user.email "your@email.com"
Example:
git config --global user.email "rahul@gmail.com"
Always use the same email address that you plan to use for GitHub.
Why is Configuration Important?
Whenever you create a commit, Git stores information such as:
Author Name
Email Address
Date
Time
Commit Message
This allows Git to identify who made each change.
Checking Your Configuration
To display all configured settings, run:
git config --list
Example output:
user.name=Rahul Sharma
user.email=rahul@gmail.com
Where Does Git Store Configuration?
Git can store configuration at three different levels.
System Level
Applies to all users on the computer.
Command:
git config --system
Global Level
Applies only to your user account.
Command:
git config --global
Local Level
Applies only to the current repository.
Command:
git config --local
Priority:
Local
↓
Global
↓
System
Local settings override Global settings, and Global settings override System settings.
Updating Your Name or Email
If you make a mistake, you can update the values at any time.
Example:
git config --global user.name "Amit Kumar"
git config --global user.email "amit@gmail.com"
The new values replace the old ones.
Common Installation Problems
Problem 1
Error
git is not recognized as an internal or external command
Solution
Restart your computer or reinstall Git, ensuring that Git is added to the system PATH.
Problem 2
Command Not Found
git: command not found
Solution
Git is not installed correctly or is not available in the system PATH.
Problem 3
Wrong Version Displayed
Update Git by downloading the latest version from the official website or using your operating system's package manager.
Best Practices After Installation
Once Git is installed:
Keep Git updated.
Configure your name and email immediately.
Use Visual Studio Code as your default editor if possible.
Verify the installation using
git --version.Use Git Bash or a terminal for practice.
Summary
Installing Git is the first practical step in learning version control. The process is straightforward across Windows, macOS, and Linux. After installation, verifying the version and configuring your name and email ensures that Git is ready to track your work correctly.
With Git successfully installed, you are now prepared to create your first repository and begin using Git commands.
Comments
Post a Comment