How to import key that signs a repository for dnf/yum

dnfgpgyum

I've ran into this for dnf only, but I assume it's the same for yum. I can't find any explanations on how this is supposed to work.

One can set repo_gpgcheck=1 in repository config file. So dnf is now supposed to check the signature of the repository data itself. I assume it still uses the gpgkey value from the repository config file.

How can I import that key into whatever key repository that dnf/yum are using to do the key check? I'm stuck with "Importing GPG key…" prompt every time the repository signature is validated, and there is no reason for me to not add a key as a trusted key. The keys imported by RPM do not work, I assume a different repository is checked for keys that can sign the repositories.

Best Answer

Using

rpm --import <YOUR_PUBKEY_PATH_HERE>

Source.