Cloning Github Repository from Mac Terminal

I’m starting to play with deep learning, machine learning, artificial intelligence in a variety of ways from statistics, linear algebra, calculus, Python via KhanAcademy,, Coursera courses, Udacity Courses, EdX courses (refreshing my memory in some cases). So I thought I would start to blog about my discoveries which will hopefully help you as well.

I was watching a video by Siraj Rival about Python for Data Science and he had put a code sample up on Github. Github is a repository for code (an online code versioning system) where people post and share code with each other. It’s becoming more of an online resume where employers can see that you’ve actually worked on projects, not just padded your resume 🙂

So when we find a cool project we want to play with we can download the code to our local machine using Git on our Macs. Git is a code versioning system (maintaining/updating code in an organized way) and Github is an online version of that. If you don’t know how to install Git, check out this article on installing Git.

Instead of downloading a zip file, forking the repo (using Github website to copy the code to my Github account) or using Github for Mac I wanted to download the code from the command line.

In the image above you see a green Clone or download button for a Github project. The project uses Scikit-learn for Python to do data analysis. Click that to see a dropdown where you can copy and paste the URL to the .git file. We’re not going to download the ZIP file. We’re going to pull the files from the Mac terminal instead. Go ahead and open a Mac terminal (it’s under Applications->Utilities). Go to a directory you’d like to install the code in (I use the default which is Users/myusername).

To clone a Github repository you just type:
git clone <URL to repository>

so for us, this is:
git clone

This pulls the code down and will make a directory based on the project name (gender_classification_challenge). Now you can cd (change directory) into the gender directory and play with the code like I am going to do!

About the Author wkriski

follow me on:

Leave a Comment: