HOW TO ADD SSH KEY TO GITHUB
GitHub offers a convenient SSH key feature
for accessing your repositories on the command line. Instead of using usernames
and passwords every time you push to or pull from your repository, you can use
your key. In this article we’ll learn how to add SSH keys to your GitHub account.
Why do we use SSH Key ?
Using an SSH key is
a convenient and secure way to access your account. It’s convenient because you
don’t need to remember a long password. And you can make your actual password
so brutally long and secure that no human or bot could guess it. The SSH key
works like an actual key that only you possess.
How to Create SSH KEY?
In order to use an SSH key with Git, you
must first create the key on your computer. If you already have an SSH key, you
can skip these steps. In order to check if you have a key, you can run this
command:
Copy
Command in terminal : ssh-add -l
Follow along with the steps below to create
the key and copy its contents. You will need to open your computer’s default
terminal application.
Open the terminal app on your computer.
Enter the following command, substituting rash@example.com with your email address:
Copy
Command
in terminal : ssh-keygen -t rsa -b 4096 -C "xyz@example.com"
Press Enter to accept the default file
location.
Enter a secure passphrase.
Press Enter.
Enter this command to display the contents
of your public key:
Copy
Command
in terminal: cat .ssh/id_rsa.pub
Copy the contents of your key to your clipboard
(we will need it later).
It’s important to remember that the SSH key
has two parts: a private key and a public key. As the name suggests, the
private key is only for private use. Never ever share your private key with
anyone (with exceptions made for your system administrator or other trusted
people within your organization). This will be important later.
0 Comments