Install Git on Ubuntu

Ubuntu: Install Git

Git is a distributed version control system widely used for software development. This guide explains how to install Git on Ubuntu 20.04, 22.04, or later.


Step 1: Update Package Lists

sudo apt update


Step 2: Install Git

sudo apt install git -y


Step 3: Verify Installation

git --version


Step 4: Configure Git

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

git config --global user.email "you@example.com"


Best Practices

  • Always configure your username and email before committing
  • Use SSH keys for secure GitHub/GitLab access
  • Regularly update Git to benefit from new features