- Make sure that you set the username and email address via git config
- git config --global user.email "solendogan.sap@gmail.com"
For all the operations we will use git bash,its like a linux environment! ##STEPS
-
First generate the Public and Private Keys, go to Git bash
ssh-keygen -t rsa -b 4096 -C "solendogan.sap@gmail.com"
Follow and save all the defaults, dont choose another path to save!
Make sure you choose a passphrase, you can leave it blank but not recommended! if success it will generate a .rsa(private key) and id_rsa.pub(public key) under .ssh folder
-
Add the key to the SSH Key agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Now we have added the SSH Key to our system next step is to add the public key to your Github Account
-
Copy your public Key Git bash you can use clip cat ~/.ssh/id_rsa.pub | clip or
clip < ~/.ssh/id_rsa.pub
-
Go and add the public key that you copied to your github account!
Go to Settings under SSH and GPG Keys Create a new SSH Key naming it like Work_laptop Then paste the RSA Key and save.
You are all set and can use SSH key to clone or push to a repo without using uername and password