Steps we need to follow:
- Create SSH keys
- Copy public key on GitHub
Step 1: Create SSH keys.
Windows:Eun PUTTYgen ➔ Click on Generate ➔ Rotate mouse over the screen to create ssh keys ➔ we need to save both Public and Private keys ➔ Close.
Linux:
Use below mentioned commands to generate keys in Linux machine:
$ ssh-keygen
This will generate the keys in '.ssh' folder at the home folder of the user.
$ cd /home/divakar/.ssh
# ls
This will list two files 'id_rsa' and 'id_rsa.pub'. File with extension '.pub' is the public key and another one is the private key.
Step 2: Copy public key on GitHub:
$ cd /home/divakar/.ssh$ cat id_rsa.pub
Copy the contents shown as a result.
Go to GitHub on the browser and on the right upper side click on the profile picture ➔ Settings ➔ SSH and GPG keys ➔ New SSH key ➔ Title: <provide a title which you want> ➔Key: <paste copied key here> ➔ Add ssh key.
Connect to GitHub with SSH |
This will add our key on GitHub.
Now, we can access GitHub using SSH path and as once we have provided keys, there is no need to provide keys all the time for this user. But if we navigate to another user, we can copy previous user keys or can create other keys for this user. But before creating new keys or copying old keys, we are not able to get access.
No comments:
Post a Comment