Last active
December 20, 2015 06:49
-
-
Save polymetis/6088368 to your computer and use it in GitHub Desktop.
Ssh helper for windows.
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
#!/usr/bin/env bash | |
read -p "Enter the *email* that you use for GitHub: " email | |
ssh-keygen -t rsa -C "$email" <<! | |
id_rsa | |
! | |
key="$(cat ~/.ssh/id_rsa.pub)" | |
data="$(printf '{ "title": "%s", "key": "%s" }' "$email" "$key")" | |
read -p "Enter Your GitHub *User Name* to upload your key: " user | |
read -p "Enter Your GitHub *Password* to upload your key: " pass | |
if [ -z "$pass" ]; then | |
echo "You must enter automated upload." | |
fi | |
curl -s -u "$user:$pass" --data "$data" -X POST https://api.github.com/user/keys | |
read -p "If you would like to like to look at the instructions to set up ssh manually type yes" yes | |
if [ "$yes" == "yes" ]; then | |
start 'https://help.github.com/articles/generating-ssh-keys#platform-windows' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment