How To Delete A Repository And GPG Key In Ubuntu


In this tutorial, we will explain how to delete a repository with its GPG key in Ubuntu Systems.

A repository is a place where the developers keep the software packages. The packages in the repositories are tested and built for each version by Ubuntu developers.

The users can download and install these packages on their Ubuntu system using Apt package manager.

All packages are signed with pair of keys, a public and private key. the public key is given out to the users and the private must be kept secret.

You should add the repository key if Apt package manager wants to trust the newly added repository.

Delete A Repository

When you add a repository using, it will be stored in /etc/apt/sources.list file.

  • To delete a repository from Ubuntu, open the /etc/apt/sources.list file and find the repository then delete it as shown below
sudo vim /etc/apt/sources.list

 Simply remove the entry. then save and close the file.

  •  You can also delete the PPA repository using add-apt-repository command.

Example: Deleting the akulavich-lightTable repository then run apt update command to update the software resource list as shown below.

sudo add-apt-repository -r  ppa:dr-akulavich/lighttable
sudo apt update

Delete Repository keys

  • Firstly, to list the added keys, run the command:
sudo apt-key list

This command will list all added repository keys as shown below

  • Stop trusting the key, the long 40 characters hex value as shown above in the screenshot by making Apt package manager to delete it with the command:
sudo apt-key del "D563 11E5 FF3B 6F39 D5A1 6ABE 18DF 3741 CDFF DE29"
  • Also you can select the last 8 characters only:
sudo apt-key del CDFFDE29
  • Run apt update command to update the repository list
sudo apt update


In this article, we illustrated how to delete a repository and its GPG key in Ubuntu

Thank you

unixcop Admin


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook