Clone your repository to your local machine

Now that we have all of our software installed, we will configure git on our local machine to interact with GitHub. Our first goal is to download the materials in your GitHub repository to your local machine.

When we have the files on our local machine, we can then make changes using an editor of our choice. We recommend using The Jupyter Notebook to edit .ipynb files, so you can see exactly how they will look online.

Note

There are a variety of other editors that will open and edit .ipynb files, from the most basic tools like TextEdit (OS X) or Notepad (Windows 10) to advanced, fully-featured Integrated Development Environments (IDEs) such as Visual Studio and PyCharm. For our purposes, simple editors will be enough but you may eventually want to investigate other options that have many helpful features.

Setting up git on your local machine

We will use the following git commands to set up git. We will only use them a single time. They are important for setup, but you will not use them again unless you set up git on another machine or need to re-install git.

git setup commands

English meaning

purpose

git config --global user.name "Judith Cohen"

Configure the global git user with this name

Sets the user name in git. Only needs to be run once.

git config --global user.email "username@gmail.com"

Configure the global git user with this email address

Sets the user email for git. Use the same email address as your GitHub account. Only needs to be run once.

Cloning your repository

The clone command helps us copy a repository from GitHub to our local machine. First, however, we need to grab an address from GitHub to clone our repository. Open your web browser and log into GitHub. Click on your repository. Then click on the large, green “Code” button. Finally click on the clipboard to copy the “HTTPS” address. the clone address The address will look like https://github.com/yourGitHubUserName/yourRepoName.git

Return to your terminal or Git Bash. Use the pwd command to confirm you are in the directory where you would like to make a local copy of your repository. If everything looks good, run git clone followed by the address you copied. It should look something like:

git clone https://github.com/yourGitHubUserName/yourRepoName.git

Warning

The familiar shortcut for paste in Windows (Ctrl + V) does not work in Git Bash. To paste in Git Bash, you can use the keyboard key “Insert” or right-click then select “paste”.

Congratulations! You’ve copied your repository to your local machine. Now let’s learn how to make changes.