GitHub Setting up SSH Key
Generating the SSH keys
is known as secure shell its just public and private key pairs
definition
ssh-keygen is a standard component of the Secure Shell protocol suite found on Unix, Unix-like and Microsoft Windows computer systems used to establish secure shell sessions between remote computers over insecure networks
No more talks lets learn how to set up SSH Key
Step 1
Check whether there are any existing SSH keys available to reuse.
You can use ls -al~/.ssh command to check it. (Use it in git bash)
If there are no keys, you can use ssh-keygen -t rsa -C “your_git_account_email” to generate new SSH keys for each git account.
After generating it will be asked the location to save the key file. Press enter to leave the default location
Now lets copy the key what we use is the id_rsa.pub so we need to get the key and copy it use “cat id_rsa.pub” keep the key copied for the next step😜
Step 2
Add SSH key to GitHub account
- Login to all git accounts.
- Go to settings.
- Click “SSH and CPG keys”.
- Click on “New SSH key”.
- Enter the preferred title and paste the key.
- Click “Add SSH key”.
- Repeat steps to for your all git accounts.
Now set up the config file
# account 1
Host github..com
HostName github..com
IndeittyFile~/.ssh/saved_ssh_key_filename# account 2
Host gitlab.com
HostName gitlab.com
IndeittyFile~/.ssh/saved_ssh_key_filename
Done and dusted🙌
images for more understanding