0

I'm trying to update the git version on a Debian 10 (buster) machine and running into issues with gpg key.

> sudo add-apt-repository ppa:git-core/ppa
 The most current stable version of Git for Ubuntu.

For release candidates, go to https://launchpad.net/~git-core/+archive/candidate .
 More info: https://launchpad.net/~git-core/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keybox '/tmp/tmpfqaimru3/pubring.gpg' created
gpg: /tmp/tmpfqaimru3/trustdb.gpg: trustdb created
gpg: key A1715D88E1DF1F24: public key "Launchpad PPA for Ubuntu Git Maintainers" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: no valid OpenPGP data found.

I also tried to manually add key, but still end up with same error after adding the key successfully.

> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1715D88E1DF1F24
Executing: /tmp/apt-key-gpghome.pwYjc1J0zy/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys A1715D88E1DF1F24
gpg: key A1715D88E1DF1F24: public key "Launchpad PPA for Ubuntu Git Maintainers" imported
gpg: Total number processed: 1
gpg:               imported: 1

And also:

> gpg --export  A1715D88E1DF1F24 | sudo apt-key add  -
gpg: WARNING: nothing exported
gpg: no valid OpenPGP data found.

Not sure what I'm doing wrong. I've also done update a few times.

> sudo apt-get update
Ankit
  • 3,878
  • 5
  • 35
  • 51
  • This doesn't seem to be [on-topic](https://stackoverflow.com/help/on-topic). https://serverfault.com/ seems a better place. But this has been asked tons of times already, you should be able to find your answer [here](https://stackoverflow.com/questions/21338721/gpg-no-valid-openpgp-data-found) or maybe [here](https://gist.github.com/virgilwashere/17e99763b4f0c210486d5ece2befd5f8). – 0stone0 Feb 01 '23 at 16:21
  • Thanks @0stone0, I've already tried both of those things if you see my description above, it still hasn't resolved the issue. – Ankit Feb 03 '23 at 21:05

2 Answers2

1

I tried this in a docker container and

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

doesn't work there as well. But

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1715D88E1DF1F24
sudo gpg --export  A1715D88E1DF1F24 | sudo apt-key add  -

works.

note that the only difference to your command is, that i am invoking the gpg --export command with sudo.

The explanation for this behaviour is, that

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1715D88E1DF1F24

imports the key into the keyring of root. So if you invoke the command without sudo gpg cant find the key you've imported.

joreign
  • 168
  • 4
0

As in this issue, check if you see expired keys with sudo apt-key list

Depending on what you see in /etc/apt/sources.list.d/, you could infer the URL of the 'gpgkey' to import.

curl -L https://.../git-core/gpgkey | sudo apt-key add -
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It says unknown: ``` > sudo apt-key list /etc/apt/trusted.gpg -------------------- pub rsa2048 2022-05-21 [SC] A362 B822 F6DE DC65 2817 EA46 B53D C80D 13ED EF05 uid [ unknown] Rapture Automatic Signing Key (cloud-rapture-signing-key-2022-03-07-08_01_01.pub) sub rsa2048 2022-05-21 [E] pub rsa1024 2009-01-22 [SC] E1DD 2702 88B4 E603 0699 E45F A171 5D88 E1DF 1F24 uid [ unknown] Launchpad PPA for Ubuntu Git Maintainers /etc/apt/trusted.gpg.d/debian-archive-bullseye-automatic.gpg ------------------------------------------------------------ – Ankit Feb 03 '23 at 21:17
  • @Ankit So nothing expired, then? Did you see at any point a `public key is not available: NO_PUBKEY ...`? – VonC Feb 03 '23 at 21:34
  • none of the keys in that list have expired. – Ankit Feb 06 '23 at 05:16