Friday, April 21, 2017

Adding a public SSH Key to Github

At first, I did not add my public SSH key to Github. I can still push my projects to Github without SSH key, but it seems that there are more and more people adding their SSH key to Github.

How to add a public SSH Key to Github:

1. Register a Github account if you don't have one.

2. Replace my name and email address in the following steps with the ones you used for your Github account:
git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com"
3. Print your public SSH key using cat command:
cat ~/.ssh/id_rsa.pub
And then, the shell terminal will display a long text staring with ssh-rsa and ending with "YOUR@EMAIL.com"
ssh-rsa
blah blah blah
YOUR@EMAIL.com

4. In Firefox:
  • Go to URL: https://github.com/settings/keys
  • Click the New SSH Key button
  • In the Title text box, give it a name (e.g. Desktop)
  • In the Key text box, copy and paste your public SSH key from Step 3 to the text box
  • Click the Add SSH Key button

5. To check if it works, in Linux shell terminal, type:
ssh -T git@github.com
and type "yes" and the prompt.

6. You should get a message like this:
Hi jimmy2046! You've successfully authenticated, but GitHub does not provide shell access.
 
References:
https://gorails.com/setup/ubuntu/16.04#git


No comments:

Post a Comment

How to kill an abandoned process in Linux/Unix

I remembered it, then I forgot, then I remembered it, and then I forgot again. In case of a Linux/Unit process hang, I have to figure out ...