Using Git to get assignments for grading

Overview

For the basics, look at the instructions for student checkins. Note that these instructions assume a bash shell, with commands run in a terminal window (e.g. ssh or putty) on the gl.umbc.edu linux system.

Variables

First create some shell variables to make the later commands easier.

WORK=grading-directory
REPO=class-repository

Initial checkout

Instead of checking out a single user directory, you want a copy of all of the directories

mkdir $WORK
cd $WORK
for i in $REPO/*.git; do git clone $i; done

Getting student work

To get the latest work from all students

cd $WORK
for i in *; do (cd $i; git pull); done

To grade a particular student

cd $WORK/studentID/assignment
git log              # see when they committed
# create grade.txt with grades for this assignment
git add grade.txt    # tell git that this file needs to be committed
git commit -m "assignment X grades"

Checking in grades

Push grades to all students

cd $WORK
for i in *; do (cd $i; git pull; git push); done

Remote access

It is possible to access the student repositories from another system instead of being logged directly into gl.umbc.edu. Unfortunately, I only have rough instructions for that.

Option 1:

Install an AFS driver (e.g. OpenAFS). Use your UMBC credentials to obtain an AFS token to mount /afs/umbc.edu. Follow other directions as for the GL system.

Note that I no longer use this method on my laptop because the OpenAFS driver prevented the laptop from ever sleeping and killed my battery life.

Option 2:

Add ssh://username@gl.umbc.edu to the beginning of the repository path, and use command-line git commands on your local system. You will need to clone each student's directory one-by-one, since $REPO/*.git will not work. You will also need re-enter your password for each clone, push or pull operation.

Option 3:

Use the same ssh-based repository path with a git graphical user interface. SourceTree runs on Windows and Mac, can deal with ssh-based repositories and will remember an ssh password. GitHub desktop cannot deal with an ssh repository that requires a password, but you can launch a "git shell" from the github program, follow Option 2 for cloning, then use the GUI for any add or commit operations. You will still need to use the git shell again for any operation that does require a password (push or pull).