On GitHub add ssh key means to add our public key on GUI portal of GitHub for communication without password. I think everyone knows about it there are mainly two way to communicate with our repository on code management server that is SSH or HTTP method.
https://linuxdady.com/github-add-ssh-key/
Separation of Lanthanides/ Lanthanides and Actinides
Github add ssh key
1. LinuxDady.Com
On GitHub add ssh key step by step
for beginners
For more information visit
https://linuxdady.com
2. On GitHub add ssh key for
repository communication
BY DEEPAK KUMAR · PUBLISHED OCTOBER 28, 2019 · UPDATED OCTOBER 28, 2019
On GitHub add ssh key means to add our public key on GUI portal of GitHub
for communication without password. I think everyone knows about it there
are mainly two way to communicate with our repository on code management
server that is SSH or HTTP method.
But if we will not add ssh key then we have to give password every time for push
or pull our code in our public or private repository that’s become very hectic
task. So, to avoid this we have to add ssh key on GitHub GUI dashboard first.
GitHub add ssh key
I think everyone knows about use case of public and private key. So, we are
going to create public and private key for communication. I want to tell you that
we will add public key on GitHub, and we will use private key for
communication. Mind it there is no need to generate new private key for every
developer. We can use same private key for every developer just distribute that
key to new upcoming developers.
Because we know very well ssh key is not system based they are pair-based
means if you added public ssh key on GitHub then anyone can communicate
3. with your GitHub repository if he/she have private key. So, use below command
to create key pair.
1 ssh-keygen
Now go to below location and check our private and public key has been created
properly or not.
1
2
3
cd /root/.ssh/
ls
cat id_rsa.pub
[Click & Read:– What is git and basic terminology for DevOps
engineers]
[Click & Read:– Explain git workflow for beginners step by
step]
4. As we have checked our private and public key pair has been properly created.
Now Copy public key and paste it on GUI GitHub Portal as shown below.
Click on Add SSH key button. Then it will ask for password to confirm you are
the right or wrong person that are adding key.
5. Create Git repository and push
Our key has been added now come on the terminal and try to push code in repo.
In my case I am creating fresh git repo and will try to push that repo. Let’s do it.
1
2
3
4
5
6
mkdir git-repo
git init
ls -a
touch git-repo
echo hello > git-repo
git add .
Follow below steps only once those developers which are new and committing
first time. If you are not new ignore these steps.
1
2
git config --global user.email harry@gmail.com
git config --global user.name "harry"
After adding name and mail id developers can easily able to commit and push
their changes into repository.
1
2
3
git commit -m "This is harry first commit"
git remote add origin git@github.com:KaushikDeepakkumar/git-repo.git git
push origin master
But if we will not add ssh public key pair and will try to push then it will show
below error.
6. All about add ssh key on GitHub
Mind it we can also save our credential in a file a call them there is not need of
type username and password every time. But when safety is your priority then
go with ssh key. Then is more secure than passing credential. Still anyone have
query on topic GitHub add ssh key write me in comment box. I will try my best
to resolve them.
Interview question on GitHub add ssh key
1. Can all developers use same private and public key for GitHub
repository?
2. If anyone got our private key what he/she can do?
3. Explain the repository communication method?
4. Funny question interviewer often asks to devops engineer for to check
presence of mind — what is port number of GitHub? Please answer this
in comment box. Our team is waiting your answer.