From b9bf611fb89761b8aeeadd7a00c269ce71656130 Mon Sep 17 00:00:00 2001 From: Mari Date: Wed, 6 May 2020 16:37:16 -0400 Subject: [PATCH] Autocommitted updated scripts from mari-wovn --- new-host.sh | 18 +++++++++++++++++- ssh/known_hosts | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/new-host.sh b/new-host.sh index e310afe..b352a75 100644 --- a/new-host.sh +++ b/new-host.sh @@ -23,9 +23,25 @@ if [[ ! -f ~/.ssh/id_ed25519.pub ]]; then echo "*** New keypair generated. Please add the new public key to github/bitbucket authorized keys:" cat ~/.ssh/id_ed25519.pub - read -p "Press ENTER after adding this public key to github/bitbucket authorized keys." + read -s -p "Press ENTER after adding this public key to github/bitbucket authorized keys." fi +function getCurrentGithubId() { + local RESULT; + RESULT=$(ssh -o "IdentitiesOnly=yes" -i ~/.ssh/id_ed25519 -T git@github.com &1) || echo "$RESULT" >&2; exit 1 + USERNAME=$(echo "$RESULT" | sed -n 's/^Hi \([^!]\+\)! You'"'"'ve successfully authenticated, but GitHub does not provide shell access\.$/Successfully authenticated to GitHub as \1/; T; p') || exit 1 + echo "$USERNAME" + [[ -n "$USERNAME" ]]; +} + +READING=true +while "$READING" && ! RESULT=$(getCurrentGithubId) || [[ $RESULT != 'programmablereya' ]]; do + read -p "Press ENTER after adding this public key to github/bitbucket authorized keys, or enter 'no' to skip this step: " FROM_ME_DAWG + if [[ 'no' == "$FROM_ME_DAWG" ]]; then + READING=false + fi +done + ORIGIN=$(git ls-remote --get-url origin) if [[ "$ORIGIN" != 'git@github.com:programmablereya/common-configs.git' ]]; then git remote set-url origin git@github.com:programmablereya/common-configs.git diff --git a/ssh/known_hosts b/ssh/known_hosts index 2af0148..37ae010 100644 --- a/ssh/known_hosts +++ b/ssh/known_hosts @@ -2,3 +2,5 @@ |1|QIVMLB+fPGDewwH5Ok92lLRGbHA=|s4HHxz4BS8FOsXyYGkmGDbm3BR8= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA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