Created
September 26, 2016 05:09
-
-
Save kyubuns/f535d725026653f37e07f472ba2d22a5 to your computer and use it in GitHub Desktop.
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 | |
# $HOME/accountsにgithubのユーザー名を行区切りで書いておく | |
# accountsファイルは空行可、先頭に#でコメントが書ける | |
set -eu | |
pushd "$HOME" | |
test -r accounts | |
test -w .ssh/authorized_keys | |
if [[ ! -f authorized_keys_origin ]]; then | |
cp .ssh/authorized_keys authorized_keys_origin | |
fi | |
for username in $(grep -v '^#' accounts); do | |
echo "https://github.com/${username}.keys" | |
done | xargs curl --silent >> .ssh/authorized_keys | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment