What is the public URL for the Github public keys

frazras picture frazras · Apr 23, 2013 · Viewed 22.6k times · Source

I heard that there was a public URL for all users on github where you can access their public keys or they can supply that URL of all their public keys. Is this true? If so what is that URL. Does it exist for bitbucket as well?

Answer

frazras picture frazras · Apr 23, 2013

You can get with:

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

Replace <username> with the actual username of the GitHub user.

This is useful when you set login permission to other servers. Just save its output into ~/.ssh/authorized_keys. To append it to the end from the command line:

curl https://github.com/<username>.keys | tee -a ~/.ssh/authorized_keys

It can also be done using Github API

curl -i https://api.github.com/users/<username>/keys

For bit bucket you can use the following: (This call requires authentication.)

curl -i https://bitbucket.org/api/1.0/users/<accountname>/ssh-keys