cdignam
cdignam

Reputation: 1453

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

Upvotes: 20

Views: 5703

Answers (3)

VonC
VonC

Reputation: 1327164

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]

Upvotes: 8

jnovack
jnovack

Reputation: 8867

If you do not want to use the API, because you do not want to process the data returned, you can get a raw key from:

curl https://github.com/<username>.gpg

The output can be used directly for import.

$ curl https://github.com/web-flow.gpg | gpg --import

Upvotes: 25

mross
mross

Reputation: 21

Also github.com/<username>.gpg works, at least within GHE it does, I haven't verified on public github

Upvotes: 2

Related Questions