Getting Started with Git

If you are using git for the first time, you can use Github’s tutorial to learn about Git. And for people want a bit more in-depth information, Pro Git is an excellent book which goes into details on using Git for daily code maintance, which you can read online for free.

A fun fact : Git is actually not that mysterious as many people might think, it’s just a key value store (Dictionary, Hashmap) that does a bit smart calculation. Key is usually the SHA1 of your file, and value the content. Pro Git provides a chapter on demystifying Git.

Git Repositories for Homework

  1. Each on of you should have a CS account, so that you can login into ds-git.cs.columbia.edu to create and manage your own repository.
  2. Create a repository called homework for all your homework assignments. All your homework needs to be committed and pushed to this repository
  3. We will release a main repository that is going to be used for checking out skeleton code, and another repository for solution as well, soon as new homework requires them.
  4. Each of the homework will be in its own branch, e.g. homework1 for homework 1, homework2 for the homework 2, etc.

Homework Submission

  1. For each homework, you need to create a separate branch for it. E.g. run git checkout -b homework1 to create homework1 branch to put your code for homework 1.
  2. Submit your homework before the deadline. We will start the script to harvest your using crontab at the precise deadline.

How to test your code locally

In case you don’t have the access to the clic lab machines, you can still setup a development environment using the following process:

  1. Install VirtualBox and Vagrant1 so that you can save time to do the development instead of managing the virtual machines.
  2. In your console, use the following commands to setup your development environment.
mkdir dds 
cd dds

#set up a virtual machine named "homework" with the specified image address 
vagrant init homework http://ds-git.cs.columbia.edu/files/homework.box 

#bring up the VM
vagrant up

Now you can use vagrant ssh into the machine just like ssh into a remote machine, you can read the website for more information.

Note the dds folder itself is mounted inside the virtual machine as well under /vagrant, so you can do development locally in your editor and switch back to VM to test your code.

How to test your code remotely

You need to ssh into the clic-lab cluster by using the following command:

ssh <uni>@clic-lab.cs.columbia.edu

The rest of the procedure is the same as if you were developing locally. Note that your home directory is NFS mounted. So it’s the same everywhere no matter which machine in the cluster you have connected to.

Attention

Make sure that you are working on the correct branch, so when we check the code out from your repository, it is contains the file that you have been working on.


  1. This is a piece of software that helps with developing with virtual machines. You can easily setup and tear down your environment.