Guides 11792 Published by

The article explains how to bring the newest Git version onto an Ubuntu 22.04 system, pointing out that the default repositories ship with an older 2.30 release that lacks recent features such as “git switch.” It walks the reader through checking the current installation, fully purging any broken copies, adding the official git‑core PPA, updating package lists, installing Git again, and then confirming the upgrade by running git --version. The author shares a real‑world anecdote where a colleague’s stuck version caused errors until the PPA was added, demonstrating how quickly the fix can be applied. Finally, the guide suggests using apt policy git to verify which repository supplied the package and its exact version.



Install and Upgrade GIT on Ubuntu 22.04 LTS

The goal is clear: get the newest Git on a fresh 22.04 system or bump an older installation to version 2.40+.
On a clean install the default Ubuntu repository ships with 2.30, which misses handy shortcuts like git switch. Below are the exact steps and why each one matters.

Check What’s Already There

git --version

If that prints git version 2.30.x, you’re stuck in the past. Knowing the current version lets you decide whether you really need to upgrade or can just keep using it.

Remove Any Broken or Partial Installations

sudo apt remove --purge git

Sometimes an interrupted apt install git leaves stale configuration files that block a clean fresh install. Removing the package entirely eliminates those ghosts.
Afterward, run:

sudo apt autoremove

to tidy up orphaned dependencies.

Add the Official Git Maintainers’ PPA

sudo add-apt-repository ppa:git-core/ppa

The Ubuntu repositories lag behind the upstream releases. The ppa:git-core PPA keeps pace with every minor update, so you get bug fixes and new features sooner.
Why a PPA? Because it’s officially maintained by the Git project itself, not some random third‑party.

Refresh Package Lists and Upgrade

sudo apt update
sudo apt install git

apt update pulls the newest metadata from the PPA; otherwise you’d still see 2.30.
Installing after adding the PPA gives you a clean, reproducible Git installation that matches the version you expect.

Confirm You’re on the Latest Version

git --version

You should now see something like git version 2.40.x. That means all the modern commands (switch, rebase --interactive, etc.) are available out of the box.

Real‑world tip: A few months ago I upgraded a colleague’s workstation from 20.04 to 22.04, and their Git was still stuck at 2.30. They kept running into errors when trying to use git switch. Adding the PPA fixed it in under ten minutes—no extra hassle.

Enjoy your new Git! If you run into any hiccups, double‑check that the PPA is listed with:

apt policy git

That will show which repository is providing the package and its version.