Created
January 30, 2024 16:10
-
-
Save azrsh/91149d024587e1feaf37ebf5913bb3c1 to your computer and use it in GitHub Desktop.
Copy public keys registered in GitHub
This file contains 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
#!/bin/bash | |
HOST=$1 | |
curl -sSL "https://github.com/$(gh api user | jq -r '.login').keys" | ssh "${HOST}" 'TEMP=$(mktemp); cat - ~/.ssh/authorized_keys | sort | uniq > ${TEMP}; cat ${TEMP} > ~/.ssh/authorized_keys' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment