diff --git a/new-host.sh b/new-host.sh index b352a75..ba3b000 100644 --- a/new-host.sh +++ b/new-host.sh @@ -28,7 +28,8 @@ fi function getCurrentGithubId() { local RESULT; - RESULT=$(ssh -o "IdentitiesOnly=yes" -i ~/.ssh/id_ed25519 -T git@github.com &1) || echo "$RESULT" >&2; exit 1 + RESULT=$(ssh -o "IdentitiesOnly=yes" -i ~/.ssh/id_ed25519 -T git@github.com &1) + [[ $? -ne 255 ]] || 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" ]];