Last active
August 29, 2015 14:00
-
-
Save brownman/570b507c9898f5dfa21a to your computer and use it in GitHub Desktop.
ssh + gihub : create and upload Public Key
This file contains hidden or 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
| #!/bin/bash | |
| #depend: xsel pv | |
| intro(){ | |
| echo 'Dependencies:' | |
| cat $0 | grep depend | grep -v grep | |
| echo Press any key to continue | |
| read | |
| } | |
| proxy(){ | |
| args=( $@ ) | |
| cmd="${args[@]}" | |
| echo "[cmd] $cmd" | |
| eval "$cmd" | |
| } | |
| set -e | |
| set -o nounset | |
| #set -x | |
| clear | |
| pv1(){ | |
| echo "$@" | pv -qL 10 | |
| #"$(10+(-2 + RANDOM%5))" | |
| } | |
| intro | |
| pv1 add github ssh public key | |
| pv1 Lists the files in your .ssh directory | |
| proxy cd ~/.ssh | |
| proxy ls -al | |
| proxy ssh-keygen -t rsa -C "brownmanXXX@gmail.com" | |
| pv1 Creates a new ssh key, using the provided email as a label | |
| cat <<COMMENT | |
| EXPECTED RESULTS: | |
| example: | |
| Your identification has been saved in /home/you/.ssh/id_rsa. | |
| # Your public key has been saved in /home/you/.ssh/id_rsa.pub. | |
| # The key fingerprint is: | |
| # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com | |
| COMMENT | |
| pv1 add the key to the agent | |
| proxy ssh-add ~/.ssh/id_rsa | |
| pv1 Copies the contents of the id_rsa.pub file to your clipboard | |
| #proxy xclip -sel clip < ~/.ssh/id_rsa.pub | |
| proxy xsel --clipboard < ~/.ssh/id_rsa.pub | |
| proxy exo-open https://github.com/settings/admin | |
| pv1 finally validate the connection | |
| proxy ssh -T git@github.com | |
| cat <<COMMENT1 | |
| EXPECTED RESULTS: | |
| example: | |
| [cmd] ssh -T git@github.com | |
| The authenticity of host 'github.com (192.30.252.131)' can't be established. | |
| RSA key fingerprint is XXXX:a6:48. | |
| Are you sure you want to continue connecting (yes/no)? yes | |
| Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts. | |
| Hi brownman! You've successfully authenticated, but GitHub does not provide shell access. | |
| COMMENT1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment