All About How To Configure SSH Key In Git, And What is SSH.!
ssh configration is required if we are working with private repositry.

There are few basic things, which should we know before deep dive to ssh configration.
1: what is ssh🙄?
Simple explaination of what is SSH(secure shell), it is a network communication protocol, its used to communicate two computer securly, like HTTP(hyper text transfer protocol) used to transfer hypertext like “webpages” and share data, same like this SSH is used to transfer data between two computers by using encryption, SSH used for login and other data transfer in insecure network.
2: why git use ssh.😡?
As you knwo, SSH(secure shell) give you oppertunity to transfer data between two computer scuerly, therefor if we are working on private repositry its mean we want to secure it from others and not want to expose to others, therefor git used SSH for transfering reposity data from github to local computer.
3: what is our role.😬?
Great, so i know that if we want to work with private repo, we should use strong comunication way to transfer data, and we know github used SSH for securing connection, if we want to communicate SSH connection then we need to configure it in our local machine, after configure SSH in our machine we can comunicate with github SSH connection.
4: how to configure it in our system.😶?
Ok lets start configuring SSH in our system.
We need to create keys, But wait…. what is this mean.
SSH works on Keys, mean SSH created two keys 1: public, 2: private.
Private key cliend save itself, and public key send to server or other computer which want to connect. and then we try to connect other computer.
second computer send us data by encrypting using public key, and we decrypt it by using private key, and then after decryting this data we pass it again to server, and check hmm.! its same, its mean user have secret key, its mean its valid user, we should create connection.
Lets create SSH keys and pss to github server.
Note: for working on SSH or git i recemmended, install “git bash” on your system. its a tool given by git. link.
After Download git bash apply this command.
$ ssh-keygen -t ed25519 -C "your_email@example.com"
- -t ed25519 what is this? -t for telling which algorithem should use for encrypting.
- -C “email” what is this? -C used to create commit for our public key which mention ourself.

when you hit the command it will ask you a question “Enter file in which to save the key (/c/Users/Toseef/.ssh/id_ed25519):”
there are two options: :1 press enter and dont write anything 2: write a name of your keys file name.
in my case i wrote name “toseef”
Whats Next after writing first command and what happend after that.😕!
if you see in picture above, “Enter file in which to save the key (/c/Users/Toseef/.ssh/id_ed25519): toseef” its telling something about key genration, first its telling the path where our keys will store. “/c/Users/Toseef/.ssh” its path of our keys.

Oops.! there is not file with name “toseef”.!
Because we telles git bash during first command what the file name should we want to create, but there is no file so where is file.?😨
By default when we create file by telling name to git bash, its create file on “C:\Users\your-user-name”

You can see it here, but not in .ssh folder, if you just hit enter during first command or creating ssh keys, then it will find in .ssh folder with name which git bash select for your keys.
Note: You can pass custom path during creating keys where you want to create keys.

In Picture above, i tells git bash where my files whould placed, in my case its Desktop, it will genrate my keys on Desktop with name of ali
Our Keys are Ready lets start Working.
one more thing, we created keys now we need someone who take care of our keys and who encrypt and decrypt our data against these keys, there is a tool called OpenSSH(in windows),
openssh provides agent for working with our keys.
first of all we need to start Useragent “ eval “$(ssh-agent -s)”

By using this command our ssh-agent is working now and its ready to take care of our keys, lets add our keys to ssh-agent by using this command.
“ ssh-add ‘keyname’ ”

First i go to location where my keys are located, then i run command to add key to ssh-add.
Everything is Ready so Whats Next.🥺???
Just one last thing is remain to finish our configration.!
Now we have created our keys and added them to ssh-agent,
Next is to add our public key to github server because we want to esstablish connection with github.
Step one:
Go to Github Account Settings.

Step two:
Go to SSH AND GPG Keys.

Step Three:
Click on New SSH Key and there you will see two fields one for title and second for public SSH key.
In title you can add what you want, but what about key section, before going to next just take one step back and go to where our keys are saved. and there open key which contains “.pub” in last.

Copy all text in public key.
Now go to Key section on github, and past this text to key section and press add SSH key button.

Congratulations you completed github SSH configration.
🤗🤩😍🥰
But wait…. do you know how to clone private repo.!
🥱🥱🥱😌😴
If you know then you can skip this section outherwise follow me.!
go to your private repo and chose ssh based url.


Ok lets GoodBy… You have learned how to configure github and what is SSH