Skip to content

Instantly share code, notes, and snippets.

@polymetis
Last active December 20, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polymetis/6088368 to your computer and use it in GitHub Desktop.
Save polymetis/6088368 to your computer and use it in GitHub Desktop.
Ssh helper for windows.
#!/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