Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Last active September 20, 2021 21:59
Show Gist options
  • Save mttjohnson/74ebc718a5eb036eadfa77703989c83c to your computer and use it in GitHub Desktop.
Save mttjohnson/74ebc718a5eb036eadfa77703989c83c to your computer and use it in GitHub Desktop.
ssh keys from github user via api
# You can list a user's public ssh keys by going to an address
# https://github.com/mttjohnson.keys
GITHUB_USER="mttjohnson"
curl https://github.com/${GITHUB_USER}.keys
# It is suggested that instead of just curling that end point that it would be better to use the API in any automated fashion
# https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
curl https://api.github.com/users/mttjohnson/keys
curl -s https://api.github.com/users/mttjohnson/keys | jq --raw-output '.[].key'
# Display GPG Key information for a GitHub user:
curl -s https://api.github.com/users/mttjohnson/gpg_keys | jq --raw-output '.'
# add comment referencing github user address
GITHUB_USER="davidalger"
curl -s https://api.github.com/users/${GITHUB_USER}/keys | jq --raw-output ".[] | .key+\" github.com/${GITHUB_USER}\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment