Sun Aug 16 2020
SSH also known as Secure Shell or Secure Socket Shell and usually considered more secure, for basic usage of GitHub
Author: Cesar Gomez
you should be located in home (but is not required) and from there open your terminal and use the following command:
ssh-keygen -t rsa -b 4096 -C "your_email_here"
#or if you want an ed_25519, do:
ssh-keygen -t ed25519 -C "your_email_here"
let’s explain each flag:
your email should be wrapped into quotes
Check if the SSH agent is running, and if is running you will receive a pid (Process id) back
eval "$(ssh-agent -s)"
# Agent pid 2794
To create the config file we need to access to the ~/.ssh folder that should be located in your home directory.
cd ~/.shh
Once you access to the folder we can create the config file with VIM, VSCode or any other you prefer:
#with vim
vim config
#with vscode
code config
Once the config file is create, add this lines into it, then you config file is ready.
Host *
AddKeyToAgent yes
UserKeychain yes
IdentifyFile ~/.ssh/id_rsa
To add the key simple type this in you command line:
ssh-add -K ~/.ssh/id_rsa
First you need to copy the public key from the ~/.ssh folder, to do that, execute the following command:
cat id_rsa.pub
# if you are using ed25519, do
cat id_ed25519.pub
now you can copy the public key and login into your GitHub account and go to:
then you can go into the repository you want to clone and switch from HTP to SSH.
If you cannot do push, pull or any other from your local repository, you might be consider replace the URL
git remote -v
# to list all the origins with details
git remote set-url origin <URL>
# change the origin URL, replace <URL> for the URL without the <>