Skip to content

Instantly share code, notes, and snippets.

@kyubuns
Created September 26, 2016 05:09
Show Gist options
  • Save kyubuns/f535d725026653f37e07f472ba2d22a5 to your computer and use it in GitHub Desktop.
Save kyubuns/f535d725026653f37e07f472ba2d22a5 to your computer and use it in GitHub Desktop.
#!/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