How to Install Git on Linux (Ubuntu, CentOS, Amazon Linux)¶
โ Back to Git
Overview¶
Git is a distributed version control system used to track code changes and collaborate efficiently in software projects.
In this guide, youโll learn: - How to install Git on major Linux distributions - Which package manager to use for each OS - How to verify your Git installation - Common questions beginners face after installation
This guide is suitable for beginners and DevOps engineers setting up Git for the first time.
๐ง Install Git on Linux¶
Below are the official and recommended ways to install Git on popular Linux distributions.
๐ Ubuntu / Debian¶
Update the package index and install Git using apt:
sudo apt update
sudo apt install git -y
๐ต CentOS / RHEL¶
For CentOS 7 / RHEL 7:
sudo yum install git -y
For RHEL 8 / RHEL 9:
sudo dnf install git -y
๐ข Amazon Linux¶
For Amazon Linux 2:
sudo yum install git -y
For Amazon Linux 2023:
sudo dnf install git -y
โ Verify Git Installation¶
After installation, verify that Git is installed correctly:
git --version
Expected output:
git version 2.x.x
โ Frequently Asked Questions (FAQ)¶
Which Git version should I install?¶
Use the version provided by your OS package manager unless you specifically need a newer release.
How do I update Git on Linux?¶
Use the same package manager:
- Ubuntu/Debian: sudo apt upgrade git
- RHEL/CentOS/Amazon Linux: sudo yum update git or dnf update git
Where is Git installed on Linux?¶
Git is usually installed under /usr/bin/git.
๐ฅ Watch on YouTube¶
๐ง Quick Quiz โ Install Git¶
Which command is used to install Git on Ubuntu?
๐ Want More Practice?¶
๐ Test your knowledge โ Take the Git Basics Quiz
๐ฌ DevopsPilot Weekly โ Learn DevOps, Cloud & Gen AI the simple way.
๐ Subscribe here
