Get SSH Keys From Github
Did you know you can get your public SSH keys via GitHub? I recently installed Ubuntu Server to VM. During the installation process, it asked for my GitHub username and then populated the authorized_keys file with my public keys. That was super nifty! My new install never needed to accept password-based logins and I didn’t have to worry about onboarding different machines' keys. I was curious how it worked and it turns out you can do this directly yourself via cURL:
curl https://github.com/${GITUSERNAME}.keys >> ~/.ssh/authorized_keys
The same thing works if you have uploaded GPG keys for signing:
curl https://github.com/${GITUSERNAME}.gpg
The GitHub API also exposes this info, but then you’ll have to process the returning JSON if you want to use it for your keys file:
curl https://api.github.com/users/${GITUSERNAME}/keys
Neat!