Now that we have our repository existing with a skeleton code.
We’ll try to clone it or copy it into our machine so that we can perform code changes
To clone a repository, we use git clone command followed by the repository name.
A git repository URL pattern is always
Here, we will try to clone our simple-web-app repository by issuing below command
$ git clone https://github.com/amarkum/simple-web-app.git
When we supply the above command, the entire repository folder will be copied to our current working directory. In our case, it is our home directory.
Please click Like if you loved this article?
We then change directory by using the “cd” command, to get into the simple-web-app folder.
When we do a “ls”, it displays an index.html file, which is a skeleton file to which new features have to be added.
Alternatively, you can also download all the source code in a zip file and extract the folder wherever you desire.
You can do this by going to the repository in a web browser and in the right, click on Clone or Download, and then clicking the “Download Zip” option.
This will download a compressed zipped folder which can be extracted in any desired path.
Using Sourcetree to clone a repository
Go to “Clone from URL” and key in the repository URL in there.
Select a Destination path, where the project will be saved.
Click on Clone.
After cloning, you will be able to see the file in the master branch.
Using GitHub Desktop to clone a repository
Open GitHub Desktop and click on “Clone a Repository from the Internet”.
Go to the URL tab and paste in the repository URL.
By default, the local path will be already set, in order to change the default path, click on “Choose” and select a custom path where the repository folder will be stored.
If everything seems to be OK, hit the Clone button.
Once done, you can see a switch over to the history tab to see the files and the commits.
In this tutorial, we saw how to clone a repository via the command line, or using the GitHub web interface to download the compressed folder of the repository and extract it. Also, we learned how to use two of the GUI tools to be able to clone the repository. The next tutorial will discuss how to perform a change, commit a change and push it to the repository.