Do you want to start learning how to code or want to collaborate with your team for developing with the GitHub repository and are curious how you clone it? This article will show you several easy ways to clone a GitHub repository.
Table of Content
Things You Should Know Clone GitHub Repository
- You have Git or Git Bash installed on your computer.
- You can clone your existing repository or clone another person’s existing repository to collaborate on a project.
You need to follow the steps carefully to be able to clone the GitHub repository.
How to Clone Repository Using HTTPS
You can clone a GitHub repository using the “HTTPS” method, make sure you already install Git or Git Bash on your computer to command the system to do these tutorials perfectly.
Step 1: HTTPS Clone
- From Github.com, navigate to the main page of the repository.
- Find the “Code” button.
- When we click the “Code” button, the dropdown will have a menu that we can choose. Then choose “HTTPS”.
- Copy the “HTTPS” link to start cloning the repository.
- Open Git Bash.
- In the terminal or command line (Windows git bash), type “git clone” then paste the copied link below:
$ git clone https://github.com/username/repository.git
- Now the repository was completely cloned in the local folder.
Step 2: GitHub Desktop Clone
- Sign in to GitHub.com and GitHub Desktop before you start to clone.
- On GitHub.com, navigate to the main page of the repository.
- Above the list of files, click “Code.”
- Click “Open” with “GitHub Desktop” to clone and open the repository with GitHub Desktop.
- Click Choose and, using Windows Explorer, navigate to a local path where you want to clone the repository.
Note: To capture a screen on Android, try the screenshot shortcut, screenshot combination, or Android Screenshot Assistant (recommended). - Click “Clone.”
Step 3: SSH Clone
- Sign in to GitHub.com and GitHub Desktop before you start to clone.
- On GitHub.com, navigate to the main page of the repository.
- Above the list of files, click “Code.”
- To clone the repository using an SSH key, including a certificate issued by your organization’s SSH certificate authority, click “SSH.”
- Open Git Bash.
- Change the current working directory to the location where you want the cloned directory.
- Type git clone, and then paste the URL you copied earlier.
$ git@github.com:username/repository.git
- You complete the SSH Clone methods.
Tips
- Before trying the steps above to clone a GitHub repository, make sure you already have Git Bash installed to do the “git clone.”
- You can choose to use one or the other (or both), but it is recommended that you eventually learn how to work with the Git command line interface. It’s more flexible and can be used on servers without a GUI.
- You’ll also need a GitHub account because you can’t clone some repositories without one.