You can install git on Ubuntu using the APT package manager on Ubuntu 22.04 LTS (Jammy Jellyfish) and earlier releases. To install git on Ubuntu, follow the steps given below:
First, update the Ubuntu repositories of all dependencies and upgrade the system for any pending upgrades. Nex install the latest stable version of git from the official Ubuntu repositories. Run the folliwng commands:
sudo apt update sudo apt upgrade sudo apt install git
Once git is installed on your Linux Ubuntu system, use the “git –version” command to verify the installation.
You can also directly compile git from its source and install it on your Linux Ubuntu system. Run the folliwng commands:
sudo apt install libz-dev libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext cmake gcc -y wget -c https://github.com/git/git/releases/tag/v2.41.0 -O - | sudo tar -xz -C /usr/src cd /usr/src/git-* sudo make prefix=/usr/local all sudo make prefix=/usr/local install
Once git is installed on your Linux Ubuntu system, use the “git –version” command to verify the installation.