All About How To Configure SSH Key In Git, And What is SSH.!

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.

$ 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.

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

Note: You can pass custom path during creating keys where you want to create keys.

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’ ”

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.

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.

--

--

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
Toseef Ahmad

Toseef Ahmad

Hy, i'm ReactJS Front End Developer And CYBER SECURITY Export. i love Computer Science!