Image for post
Image for post

Set git permission using ssh keys in windows 10

If you want to use git in your local PC and it’s a bit hard to “pull” and “push” you can simplify that using adding public ssh key to your GitHub account.

To start first go to your PC, .ssh folder. It’s in “C:\Users\<Your Profile>\.ssh”

“C” may change with your OS installed partition. To see the “.ssh” folder you need to tick view hidden files.

If you already have “id_rsa” and “” files in the “.ssh” folder skip the next part. However, if you want to create a new SSH key for git do not skip.

Generate SSH key

  1. Open Powershell or Command Prompt in the “.ssh” folder.

2. Use the command ssh-keygen

3. It will start generating a new SSH key, the first popup will ask to use default id_rsa file name for the key. If you already have a key or you want to rename your old keypress enter, else enter a new SSH key name.

SSH key name

4. Then comes the critical part. After pressing enter, the next message asked for a passphrase. the passphrase will need for every time you use the new SSH key. If you do not want to enter key every time you pull or push, then add an empty passphrase press enter. However, the passphrase will add an extra security layer for your GitHub repositories. Anyway, it’s better to use any passphrase.


5. After pressing enter, you will ask to enter the passphrase again. If you enter one then type that and press enter else press enter without typing anything.

Enter passphrase again

Finally, the SSH key is generated.

SSH key

You will notice two new files have been generated. One without any extension and other with “.pub” extension. The file without extension is the private key that you do not need to share. Another file is the public key which you have to share with others you want to connect with. In this case, it is GitHub.

Add SSH key to Github

Now you have a new key if you went through the last section else you have an old SSH key.

  1. Enter cat or cat <your ssh file name>.pub if you use a different name and copy the file content.
Public key

2. Go to your GitHub account and click your profile image at the to right. then click on Settings -> SSH and GPG keys.

Image for post
Image for post
Go to Settings
Image for post
Image for post
Go to SSH keys
Click on New SSH key

3. Then click on “New SSH Key” button to enter new SSH key

4. In the form Add title as you want, It will only be used as an identification mechanic for you. Then enter the Copied SSH key at the key area.

Enter SSH key

Finally, Enter “Add SSH key”.

Wow. It’s a lot. Finally, all done. now you can push, pull fetch, rebase, and many more with this Github account without any hassle.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store