Search code examples
gitdebianapt

updating git ppa error - no valid OpenPGP data found on Debian


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

Solution

  • 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.