Skip to content

Instantly share code, notes, and snippets.

@forivall
Last active February 17, 2026 21:33
Show Gist options
  • Select an option

  • Save forivall/77a5961d3030aa13c253968e9f6a5612 to your computer and use it in GitHub Desktop.

Select an option

Save forivall/77a5961d3030aa13c253968e9f6a5612 to your computer and use it in GitHub Desktop.
script to pull all of the gpg keys for a github repository
#!/usr/bin/env zsh
OUT_DIR=.tmp/gpg-keys
mkdir -p $OUT_DIR
for user in web-flow $(gh api repos/${1:-$(gh repo view --json nameWithOwner --jq .nameWithOwner)}/contributors --jq '.[].login'); do
for k in $(gh api "users/$user/gpg_keys" --jq '.[]|@base64'); do
echo $k | jq -Rr '@base64d|fromjson|.raw_key' > "$OUT_DIR/$user-$(echo $k | jq -Rr '@base64d|fromjson|.key_id').gpg"
done
echo $OUT_DIR/$user-*.gpg
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment