How to Clone/Download A GitHub Repository

GitHub has one of the largest collection of repositories in the world. From small websites to big complex software, everything is here. To get the code on your local there is no direct method you have to clone the repository to your local machine. Ther…


This content originally appeared on DEV Community and was authored by Sanjay Singh Rajpoot

GitHub has one of the largest collection of repositories in the world. From small websites to big complex software, everything is here. To get the code on your local there is no direct method you have to clone the repository to your local machine. There are 2 ways how you could do this first one is using Command-line and the other one is using the command-line. For beginners, I would suggest you use GitHub Desktop as this method is simple to use and you won’t get stuck in it.

Using Command-line

To clone a repository using Command-Line you have to first install git version control then only you will be able to clone the repo.

1.On Github, navigate to the repository page which you want to clone/download.
2.Above the list of files, you will see a green button click Code.
image

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

4.The clipboard icon for copying the URL to clone a repository

5.Open Terminal
6.Change the current working directory to the location where you want the cloned directory.
7.Type git clone, and then paste the URL you copied earlier.

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

8.Press Enter to create your local clone.

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `Spoon-Knife`...
> remote: Counting objects: 10, done.
> remote: Compressing objects: 100% (8/8), done.
> remove: Total 10 (delta 1), reused 10 (delta 1)
> Unpacking objects: 100% (10/10), done.

Method 2 – Using GitHub Desktop

1.Go to GitHub.com, navigate to the main page of the repository.

2.Above all the code you will find a Code button in green colour click it to open a small tab.
"Code" button
image

3.Click on GitHub desktop to clone and open the repository with GitHub Desktop.
"Open with GitHub Desktop" button
image

4.Follow the prompts in GitHub Desktop to complete the clone.

Conclusion

With this, you will have a folder created on your local machine with git initiated in it. Now any changes that you make in that folder can be committed easily to GitHub again.

In this document we took a deep look at git clone. The most important takeaways are:

  1. git clone is used to create a copy of a target repo
  2. The target repo can be local or remote
  3. Git supports a few network protocols to connect to remote repos
  4. There are many different configuration options available that change the content of the clone

If you face any problem with the above steps, just comment below. Read my blogs at sanjaysinghrajpoot.me


This content originally appeared on DEV Community and was authored by Sanjay Singh Rajpoot


Print Share Comment Cite Upload Translate Updates
APA

Sanjay Singh Rajpoot | Sciencx (2021-06-05T10:02:45+00:00) How to Clone/Download A GitHub Repository. Retrieved from https://www.scien.cx/2021/06/05/how-to-clone-download-a-github-repository/

MLA
" » How to Clone/Download A GitHub Repository." Sanjay Singh Rajpoot | Sciencx - Saturday June 5, 2021, https://www.scien.cx/2021/06/05/how-to-clone-download-a-github-repository/
HARVARD
Sanjay Singh Rajpoot | Sciencx Saturday June 5, 2021 » How to Clone/Download A GitHub Repository., viewed ,<https://www.scien.cx/2021/06/05/how-to-clone-download-a-github-repository/>
VANCOUVER
Sanjay Singh Rajpoot | Sciencx - » How to Clone/Download A GitHub Repository. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/05/how-to-clone-download-a-github-repository/
CHICAGO
" » How to Clone/Download A GitHub Repository." Sanjay Singh Rajpoot | Sciencx - Accessed . https://www.scien.cx/2021/06/05/how-to-clone-download-a-github-repository/
IEEE
" » How to Clone/Download A GitHub Repository." Sanjay Singh Rajpoot | Sciencx [Online]. Available: https://www.scien.cx/2021/06/05/how-to-clone-download-a-github-repository/. [Accessed: ]
rf:citation
» How to Clone/Download A GitHub Repository | Sanjay Singh Rajpoot | Sciencx | https://www.scien.cx/2021/06/05/how-to-clone-download-a-github-repository/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.