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.
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.
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.
4.The clipboard icon for copying the URL to clone a repository
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.
1.Go to GitHub.com, navigate to the main page of the repository.
4.Follow the prompts in GitHub Desktop to complete the clone.
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:
- git clone is used to create a copy of a target repo
- The target repo can be local or remote
- Git supports a few network protocols to connect to remote repos
- 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