github authentication Archives - Anuj Varma, Hands-On Technology Architect, Clean Air Activist https://www.anujvarma.com/tag/github-authentication/ Production Grade Technical Solutions | Data Encryption and Public Cloud Expert Tue, 04 Feb 2020 23:21:13 +0000 en-US hourly 1 https://wordpress.org/?v=7.0.2 https://www.anujvarma.com/wp-content/uploads/anujtech.png github authentication Archives - Anuj Varma, Hands-On Technology Architect, Clean Air Activist https://www.anujvarma.com/tag/github-authentication/ 32 32 Github and SSH authentication – Generate a key pair using gitbash https://www.anujvarma.com/github-and-ssh-authentication-generate-a-key-pair-using-gitbash/ https://www.anujvarma.com/github-and-ssh-authentication-generate-a-key-pair-using-gitbash/#respond Tue, 28 Jan 2020 17:12:41 +0000 https://www.anujvarma.com/?p=6487 Github uses SSH for authentication only. It is important to understand that it doesn’t use SSH for encrypting data back and forth. Download the entire git for windows package here. […]

The post Github and SSH authentication – Generate a key pair using gitbash appeared first on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.

]]>
Github uses SSH for authentication only. It is important to understand that it doesn’t use SSH for encrypting data back and forth.

  1. Download the entire git for windows package here. I choose the ‘Use windows CMD for the emulator’ option during the installation. If installed correctly, your ENV path variable should be setup – so typing ‘git’ in a command prompt should work.
  2. From a CMD prompt, create an SSH key pair using an email address (ideally your GitHub email address, if you plan to use this key pair for github). If you plan to just generate a key pair that is NOT to be used for github, you can use any email address. The email address just serves as a label for the key pair.
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

This creates a new ssh key pair.

3.  When you’re prompted to “Enter a file in which to save the key,” press Enter. .

4. Enter a file to save the key (defaults to  –  /c/Users/you/.ssh/id_rsa):[Press enter]
(If you do not have a .ssh folder, open up a powershell prompt and mkdir .ssh )

Note that the public key starts with ssh-rsa – and has your email at the end

$ cat .ssh/id_rsa.pub
ssh-rsa AAAA[........] johndoe@gmail.com

Add your key to the SSH agent (this is the client)

  1. Check that the agent is running  –
    $ eval $(ssh-agent -s) // should return pid of the process
  2. Add your private key to the SSH agent
    $ ssh-add ~/.ssh/id_rsa  // private key is the one without the .pub extension
    
    

3. Lastly, now that your private key is part of the agent (the client), your public key needs to be known to github (the server). To add your public key (ends in .pub) to your github account, follow these steps.

Summary

That’s it. This should be all that you need to get SSH based authentication working for github access. Generate an SSH key pair (using ssh-keygen part of gihub download), use the private key in your client agent, use the public key in the server github account – and you should be set. This avoids the headache of typing a username  and password for github authentication.

The post Github and SSH authentication – Generate a key pair using gitbash appeared first on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.

]]>
https://www.anujvarma.com/github-and-ssh-authentication-generate-a-key-pair-using-gitbash/feed/ 0