Created
December 12, 2017 03:52
-
-
Save justinian/d94a825ace90a60fddf8d71519ab5550 to your computer and use it in GitHub Desktop.
Script to update SSH keys from 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
#!/usr/bin/env bash | |
PROFILE=${1:-justinian} | |
USER=${2:-justin} | |
OUTFILE="/home/${USER}/.ssh/authorized_keys" | |
TEMPFILE=$(mktemp) | |
if curl -sL "https://github.com/${PROFILE}.keys" > "${TEMPFILE}"; then | |
if grep -q "ssh-rsa" "${TEMPFILE}"; then | |
cat "${TEMPFILE}" > "${OUTFILE}" | |
fi | |
fi | |
rm "${TEMPFILE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment