Search code examples
gitgithubgnupg

What is the public URL for the GitHub GPG keys


Is there a simple endpoint for retrieving a users gpg public key?

For SSH keys, github.com/<username>.keys, is there something similar for gpg keys?

Related: What is the public URL for the Github public keys


Solution

  • You can try using the GitHub API for GPG Keys:

    List GPG keys for a user

    GET /users/:username/gpg_keys
    

    Lists the GPG keys for a user. This information is accessible by anyone.

    weiji14 proposes in the comments:

    You can get the keys via the command line using

    curl https://api.github.com/users/<username>/gpg_keys
    

    Since Oct. 2021 and GitHub CLI gh 2.2.0, you also have gh gpg-key list:

    gh gpg-key list [flags]