You are tired of typing your email and password every time you tape
git push in your terminal or command line, so here is the way you can avoid that again once and for all.
You have to generate ssh key first and submit this key to your account in github or bitbucket, we are going to see how to generate this key either for windows 7, 8 or 10. it's gonna be easy so just follow up with me.
Installing git in you machine
I assume you have already done this, but if not just go to official website of git and look for download and after that choose the type of your system 32bit or 64bit, once you downloaded the executable file just follow the instructions and install it on your machine.
Generating an SSH Key
Now that you have been installed
git look open any folder and right click select
Git Bash Here just like as you see here in this image:
Now just tape those command on your git bash command line
ssh-keygen -t rsa -b 4096 -C "firstname.lastname@example.org"
enter you will be asked where to store the key don't worry just click
enter again to save it in the default location.
Next step you will be asked to provide
passphrase. This is optional but recommended. Just type in your password that you can remember and click enter. It will ask you to confirm and obviously just do it again.
Great now you have been generate you SSH key it's there somewhere, we will take later to use it and add it to our github or bitbucket account.
Adding SSH Key to your SSH Agent
You must know you can generate an infinite number of SSH keys. but you probably have only one key for now the one that we generated before, so now we need to allow our machine's SSH agent to know which SSH key to use. That's why we need to enable the SSH agent by running the following command again in our bash command line:
eval "$(ssh-agent -s)"
Of course you will get something like that in your command line: That's mean that the SSH agent is enabled, so we can use it now, but you should run this command to add it finally
All right, the SSH Agent, knows which key to use, so it is time to tell GitHub and BitBucket all about our key, and try to not close your bash command line yet.
Adding SSH Key to GitHub Account
Okay, the key is generated and it's there with our own informations that identify our machine, we only need to copy these key and past it to our account as easy as that, but how do we copy these ssh key? well, there is a various ways to that but we just use the easiest one, which is to use our terminal again, that why I told you to not close it :).
In order to copy our ssh key just run this following command in your bash command line:
clip < ~/.ssh/id_rsa.pub
By typing that command and hitting
enter that means that the key is copied to the clipboard, if you don't believe me just open you notepad for example and right click and paste, you'll see a long string.
Nice now you only need to go to github.com and go to settings
Now go to ssh and GPG keys on left hand sidebar
![ssh and GPG keys](/storage/images/ssh and GPG keys_1543950774.jpg)
Once you are there, just click on New SSH key Button :
Now you only need to fill those field, The title you can choose any title you want and for key just do a right click and then past the SSH key that you have been copied, that's it!!
You are done, now whenever you have to do
git push -u origin master you don't have to write your email and password, you only have to write the passphrase if you have been choose one, if not it won't ask you anything because all your informations are in the ssh key.
Adding SSH Key to BitBucket Account
Basically it's gonna be the same thing as github account, first you need to log in to you profile and look for settings, after look for SSH key and click on it just like the following images Now that you are there, Just hit on Add Key Great now you need to give to your key a name and paste the actual key in key's field, just like that
That's it, now you know how to generate an ssh key for you github or bitbucket account, on windows 7 or 8 or 10,
good luck to you.