Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the public URL for the GitHub GPG keys

Tags:

git

github

gnupg

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

like image 642
cdignam Avatar asked Mar 09 '18 00:03

cdignam


3 Answers

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
like image 99
jnovack Avatar answered Oct 19 '22 07:10

jnovack


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]
like image 7
VonC Avatar answered Oct 19 '22 05:10

VonC


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

like image 1
mross Avatar answered Oct 19 '22 05:10

mross