Last active
September 20, 2021 21:59
-
-
Save mttjohnson/74ebc718a5eb036eadfa77703989c83c to your computer and use it in GitHub Desktop.
ssh keys from github user via api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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