Update Git In Ubuntu To Latest Version

December 10, 2024
Go to the conclusion for the fix.

I was trying to push a repository to gitlab and it was very slow. I thought maybe updating the git version would help.

The current version of git is git version 2.25.1

Updating git

I tried following the instructions from this stackoverflow answer ↗️ but fails during sudo add-apt-repository ppa:git-core/ppa.

add apt-repository error

I then stumbled upon this code from this github comment ↗️

Terminal window
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EXPKEYSIG 23F3D4EA75716059

I tried the said command while replacing the key found from my error message.

apt-key adv command

Tried running the add-apt-repository command again and return the same error.

I revised the key in the apt-key command and tried the add apt repository again which still resulted to the same error.

Terminal window
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 23F3D4EA75716059

apt-key adv command revised

Scrolling down from the previous github answer I tried out adding the port 80 as stated on this github command ↗️.

Terminal window
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 23F3D4EA75716059

This still failed.

Removing the apt repository

Following this stackoverflow answer ↗️

Install ppa-purge.

Terminal window
sudo apt-get install ppa-purge

List out the repositories and find “github”.

Terminal window
grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep github

list apt repositories

Attempted to remove the listed repository but still result to the same signature verification error.

Terminal window
sudo ppa-purge -s cli.github.com ppa:packages

The conclusion

Terminal window
sudo rm /etc/apt/sources.list.d/github-cli.list

Found it from this github issue ↗️.

Followed the same commands to update git and it finally succeeded.

Terminal window
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

git updated version

And pushing to gitlab is still slow 🙃