Skip to content

Instantly share code, notes, and snippets.

@gmelodie
Created July 4, 2022 18:59
Show Gist options
  • Save gmelodie/7ca4f25c1fb2b2c7c9e0e9e36338b4d1 to your computer and use it in GitHub Desktop.
Save gmelodie/7ca4f25c1fb2b2c7c9e0e9e36338b4d1 to your computer and use it in GitHub Desktop.
Get SSH keys for all the members of a github team
APITOKEN="" # TODO: add your token here (create one: https://github.com/settings/tokens)
# be sure to check if the token hasn't expired!
# for ORG and TEAM, you can get those by navigating to your team on github
# and seeing the url, which will be in the format:
# https://github.com/orgs/{ORG}/teams/{TEAM}/discussions
# e.g. https://github.com/orgs/application-research/teams/a-team/discussions
ORG="application-research"
TEAM="a-team"
USERS=$(curl -s -S -H "Accept: application/vnd.github+json" -H "Authorization: token $APITOKEN" \
https://api.github.com/orgs/$ORG/teams/$TEAM/members \
| jq -r ".[].login")
for usr in $USERS
do
echo \# $usr
curl -s -S https://github.com/$usr.keys
done
@jimmylee
Copy link

jimmylee commented Jul 4, 2022

Very cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment