COMP 20: Web Programming

Lab: Git

Lab Objective

  1. Practice using Git and GitHub

Overview

In this course, you will be using Git and GitHub extensively to keep track of your work, communicate what you have done, work with teammates remotely (e.g., semester group project), and submit almost all assignments and labs. All assignments and labs in this course should be done on your local computer. That is, there is no need to connect to homework.cs.tufts.edu to work on assignments and labs unlike most other classes in our curriculum.

Please note that Git and GitHub are not the same. Git is the distributed version control system (software). Git is responsible for keeping track of changes to content (usually source code files), and it provides mechanisms for sharing that content with others. GitHub is a company that provides Git repository hosting. See https://programmers.stackexchange.com/questions/173321/conceptual-difference-between-git-and-github for more insights.

Instructions

Please read the following instructions first, carefully!

  1. Create a GitHub account if you do not have one already at https://github.com/.
  2. Read https://help.github.com/articles/set-up-git on setting up Git on your computer. Important Note 1: I DO NOT RECOMMEND using the native app provided by GitHub (e.g., GitHub for Mac). It isn't as flexible as using the command line and you might as well get into the habit of typing and using the command line terminal. Important Note 2: If you are using a Mac, I strongly recommend that you follow the Generating SSH Keys instructions. In the past, students have had lots of trouble using git credential-osxkeychain.
  3. Read https://help.github.com/articles/creating-a-new-repository/ on creating a Git repository on GitHub. Please name this new repository hello-world under your account!
  4. Upon creating the hello-world repository under your account in GitHub, you will see a page that looks something like the following (with the exception of the mchow01 which is my GitHub username). Screenshot
  5. On your computer using the terminal / command line, create a new directory (a.k.a., folder) named hello-world via mkdir hello-world. This directory can be located anywhere on your computer. Then go into the directory via cd hello-world (cAsE sEnSiTiVe).
  6. In the hello-world directory, follow the instructions as noted on the GitHub page (or screenshot above):
    echo "# hello-world" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin git@github.com:your_github_username_here/hello-world.git
    git push -u origin master
    

    The first line echo "# hello-world" >> README.md creates a file named README.md with one line: # hello-world.
  7. Make a second commit change. That is: find a funny image (e.g., using Google), add it to your hello-world repo, commit and push change to GitHub. Please also write short, one line, coherent commit messages (i.e., no "dr. steve brule" or "asdf" garbage). Important Note 3: Please do not use photos of other students, me, or the TAs. That is just downright creepy.

Readings, References, and Tutorials

Assessment

This lab is worth 2 points.