How to Install Git on Ubuntu 24.04

Git is the world’s most popular distributed version control system used by many open-source and commercial projects. It allows you to collaborate on projects with fellow developers, keep track of your code changes, revert to previous stages, create branches , and more.
Git was originally developed by Linus Torvalds , the creator of the Linux kernel.
This guide covers installing and configuring Git on Ubuntu 24.04 using apt, the Git PPA, or by compiling from source.
Quick Reference
| Task | Command |
|---|---|
| Install Git (apt) | sudo apt install git |
| Install Git (PPA) | sudo add-apt-repository ppa:git-core/ppa && sudo apt install git |
| Check Git version | git --version |
| Set username | git config --global user.name "Your Name" |
| Set email | git config --global user.email "you@example.com" |
| View config | git config --list |
Installing Git with Apt
This is the quickest way to install Git on Ubuntu.
Check if Git is already installed:
git --versionIf Git is not installed, you’ll see a “command not found” message. Otherwise, it shows the installed version.
If Git is not installed, use the apt
package manager:
sudo apt update
sudo apt install gitVerify the installation:
git --versionThe version of Git in the Ubuntu 24.04 repositories is 2.43.0:
git version 2.43.0You can now start configuring Git.
When a new version of Git is released, you can update using sudo apt update && sudo apt upgrade.
Installing Git from the PPA
The Ubuntu Git Maintainers provide a PPA with the latest stable Git releases. Use this method if you need a newer version than the default repository provides.
Add the PPA and install Git:
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install gitVerify the installation:
git --versiongit version 2.52.0Installing Git from the Source
The main benefit of installing Git from source is that you can compile any version you want. However, you cannot maintain your installation through the apt package manager.
Install the build dependencies:
sudo apt update
sudo apt install libcurl4-gnutls-dev libexpat1-dev cmake gettext libz-dev libssl-dev gcc wgetVisit the Git download page to find the latest version.
At the time of writing, the latest stable Git version is 2.52.0.
If you need a different version, visit the Git archive to find available releases.
Download and extract
the source to /usr/src:
wget -c https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.52.0.tar.gz -O - | sudo tar -xz -C /usr/srcNavigate to the source directory and compile:
cd /usr/src/git-*
sudo make prefix=/usr/local all
sudo make prefix=/usr/local installThe compilation may take some time depending on your system.
For changes to take effect on your current shell, you can either log out and log in or run the following source
command:
source /etc/environmentVerify the installation:
git --versiongit version 2.52.0To upgrade to a newer version later, repeat the same process with the new version number.
Configuring Git
After installing Git, configure your username and email address. Git associates your identity with every commit you make.
Set your global commit name and email:
git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"Verify the configuration:
git config --listuser.name=Your Name
user.email=youremail@yourdomain.comThe configuration is stored in ~/.gitconfig:
[user]
name = Your Name
email = youremail@yourdomain.comYou can edit the configuration using git config command or by editing ~/.gitconfig directly.
Conclusion
We covered three ways to install Git on Ubuntu 24.04: using apt, the Git PPA for the latest version, or compiling from source. The default repository provides Git 2.43.0, which is sufficient for most use cases.
For more information, see the Pro Git book .
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page