Cloning a repository from GitHub by using SSH key

This article hopes to help people to understand, how to clone a repository from GitHub. Someone get confused when cloning a repository from GitHub.

Before you clone a repository better to have an SSH (Secure Shell) key. That uses to authenticate the remote computer and allow it to authenticate the user, if necessary. So if you want to generate the SSH key using below steps.

1. Open a command window.

2. Type ssh-keygen.

3. The process of key generation will start. It asks for the file in which to save the key with other related information. (However, you can leave it empty, and it’ll generate your first key with the default name as )

4. Now copy the contents of the SSH key and add to the GitHub account. For that type the following:

cat ~/.ssh/id_rsa.pub

  1. On GitHub, navigate to the main page of the repository.
  2. Under the repository name, click
Step 2

3. To clone the repository using HTTPS, under “Clone with HTTPS”, copy the URL. To clone the repository using an SSH key, including a certificate issued by your organization’s SSH certificate authority, click Use SSH, then copy the URL.

Step 3

4. Open Git Bash.

5. Change the current working directory to the location where you want the cloned directory to be made.

6. Type , and then paste the you copied in Step 3.

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

7. Press . Your clone will be created.

--

--

Developer 💻 | SE Graduate 🎓 | Writer ✍ | Passionate STEM Engineer since 2019 👩‍🎓 Geek since ever 👾

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dulya Kemali Perera

Developer 💻 | SE Graduate 🎓 | Writer ✍ | Passionate STEM Engineer since 2019 👩‍🎓 Geek since ever 👾