But first, why?

Git is a version control system. It’s original purpose was to help groups of developers work collaboratively on big software projects. Git manages the evolution of a set of files – called a repository – in a sane, highly structured way. If you have no idea what I’m talking about, think of it as the “Track Changes” features from Microsoft Word but much, much better.

Git has been re-purposed by the data science community. In addition to using it for source code, we use it to manage the motley collection of files that make up typical data analytical projects, which often consist of data, reports, and, yes, source code.

When you want to make your work visible to other people, either in a read-only way or for genuine collaboration, you can make the associated Git repository available on the web. This can be totally public or private to your closest friends. Regardless, this reduces the extra work associated with sharing and collaboration almost to zero, which has huge benefits. GitHub is a very popular hosting site that provides this service (and more). If you have no idea what I’m talking about, think of it as DropBox but much better (at least for our purposes).

Full participation in the “data community” these days practically requires familiarity with Git and GitHub. These tools are also helpful to us for course logistics, such as sharing code between instructor and student. For both reasons, we will be using Git and GitHub. Below we explain how to install the Git software locally on your computer.

Preliminary about Git clients

Learning how and why to use version control can be rough at first. I found the use of a GUI – as opposed to the command line – extremely helpful when I was getting started. I call this sort of helper application a Git client. We have some strong recommendations about Git clients, which you can read here.

Why think about your Git client before you install Git itself? Because some Git clients will install Git for you. These are the Git clients aimed at novices, which prioritize ease of use over power. Other Git clients, aimed at intermediate/advanced users, assume you will install Git yourself. So it’s best to have a coordinated plan with respect to installing Git and a Git client.

Our recommendations vary by operating system, so read the section that applies to you below.

Git installation: Windows

Option 1 (recommended): We concur with Software Carpentry, an organization that “teaches lab skills for scientific computing”, and paraphrase their installation instructions:

Option 2 (we do not recommend this as of 2014-09-14): The GitHub hosting site offers GitHub for Windows that provides Git itself, a client, and smooth integration with GitHub.

After installation, you still need to introduce yourself to Git and get it to remember your GitHub username and password. If your Git client guides you through this, seize that opportunity! Otherwise follow the links for some assistance.

Git installation: Mac

Option 1 (recommended): Install Git from here: http://git-scm.com/downloads.

Option 2: You can also get Git from Apple’s developer tools. Exactly how to do this varies quite a bit across different OS X versions, plus it seems to be inferior to the other approaches I present. Will not flesh out unless this changes.

Option 3: The GitHub hosting site offers GitHub for Mac that provides the option to install Git itself, a client, and smooth integration with GitHub..

Option 4: If you anticipate getting heavily into scientific computing, you’re going to be installing lots of software. You should check out homebrew, “the missing package manager for OS X”. Among many other things, it can install Git for you. Our own TA Shaun Jackman works on homebrew-science, so he’s the local expert.

After installation, you still need to introduce yourself to Git and get it to remember your GitHub username and password. If your Git client guides you through this, seize that opportunity! Otherwise follow the links for some assistance.

Git installation: Linux

If Git is not already available on your machine you can try to install it via your distro’s package manager (e.g. apt-get or yum).

Ubuntu or Debian Linux

sudo apt-get install git

Fedora or RedHat Linux

sudo yum install git

After installation, you still need to introduce yourself to Git and get it to remember your GitHub username and password.