Last active
December 30, 2018 14:40
-
-
Save Voronenko/a71d53697d14768744d9 to your computer and use it in GitHub Desktop.
Adds my public keys to authorized_hosts
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
IFS="$(printf '\n\t')" | |
mkdir -p ~/.ssh | |
if ! [[ -f ~/.ssh/authorized_keys ]]; then | |
echo "Creating new ~/.ssh/authorized_keys" | |
touch ~/.ssh/authorized_keys | |
fi | |
if type "curl" > /dev/null; then | |
keys=`curl https://api.github.com/users/voronenko/keys | grep -o -E "ssh-\w+\s+[^\"]+"` | |
fi | |
if type "wget" > /dev/null; then | |
keys=`wget -qO- https://api.github.com/users/voronenko/keys | grep -o -E "ssh-\w+\s+[^\"]+"` | |
fi | |
for key in $keys; do | |
echo $key | |
grep -q "$key" ~/.ssh/authorized_keys || echo "$key voronenko@github" >> ~/.ssh/authorized_keys | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ curl -L http://bit.ly/voronenko | bash -s
wget -qO- http://bit.ly/voronenko | bash -s