Last active
May 23, 2019 11:55
-
-
Save adyjs/96bb69f41ab1172bab5df06b3978b2d0 to your computer and use it in GitHub Desktop.
git and github ssh key setting
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
| steps for setting SSH key on Github and localhost | |
| --------------------------------------------------------- | |
| 1. generate SSH key on localhost ~/.ssh/ssh_key_folder | |
| https://help.github.com/en/enterprise/2.16/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key | |
| 2. if there is more than 1 Github account , | |
| then need to setting "config" file in ~/.ssh folder | |
| https://gist.github.com/adyjs/902805f51b7163181046b9158616e368 | |
| 3. activate ssh-agent for add private SSH key | |
| $ eval "$(ssh-agent -s)" | |
| (if it's works , will see agent pid like this.) | |
| > Agent pid 59566 | |
| 4. using ssh-add command to | |
| (a.) delete cached key | |
| $ ssh-add -D | |
| (b.) add new private key | |
| $ ssh-add ./ssh_key_folder/private_key (usually default named "id_rsa") | |
| (c.) list and check added key | |
| $ ssh-add -l | |
| 5. go Github website and login , | |
| then adding SSH key | |
| 6. cat ~/.ssh/ssh_key_folder/id_rsa.pub | |
| copy public SSH key , then paste on Github | |
| 7. test it , | |
| clone and push any repo for ensure everything works fine. | |
| ref: | |
| -------------------------------------------------------- | |
| # ssh-agent | |
| https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent | |
| https://blog.gtwang.org/linux/using-ssh-agent-forwarding-to-avoid-being-asked-passphrase/ | |
| https://www.ssh.com/ssh/agent | |
| # ssh-add command | |
| http://man.linuxde.net/ssh-add | |
| # multiple github account ssh key setting | |
| https://gist.github.com/jexchan/2351996 | |
| # existing ssh key | |
| https://help.github.com/en/enterprise/2.13/user/articles/checking-for-existing-ssh-keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment