Cloning a Repository
In this article we will be using the Repository we forked in the previous walkthrough article.
Cloning a repo will work for any repository on GitHub you are authenticated to view. An original project, a forked project, or a project you have created previously that you would like to access on a new machine.
The command used to accomplish this task is
The main purpose of cloning a repository is to setup a local repository that is an exact copy of a remote repository. This allows you to make changes and commits locally. You can always sync your local and remote repositories (
git push &
There are a few ways to clone a repository. The simplest way is to grab the github project url and run the
git clone command inside of your terminal.
Copy Github Project URL
Locate GitHub URL from your repository by hitting the green
Code button and copying the link to your clipboard.
Now open up a new terminal and navigate to the directory where you want the project to live. In the below example you will see that we are cloning the project into the
make sure to replace
/[your-github-user]/ with your own personal github username while also inside the directory where you want the project to live.
Run the command
git clone https://github.com/[your-github-user]/py-demo-web-logs.git in the terminal.
This will create a new directory (inside of your current working directory) named
py-demo-web-logs, initialize a local git repository (located in the
.git directory) and copy all of the tracked files.
If you run the
ls command you can see that the folder has been cloned:
Explore Cloned Local Files
Now that you have cloned a repository onto your machine you can access the files locally. Take a look at what the
Navigate into the newly cloned directory and run the
You will see that there is a
main.py file located within.
This walkthrough was a refresher on the following:
- Cloning a Repository
git clone https://github.com/git-repo-url
In the upcoming
branching walkthrough we will be creating a new branch inside of this project directory and fixing a bug located within the main.py file of our