Setting up Git/AFS for class submissions

These instructions assume the bash shell, running commands on the gl.umbc.edu linux server.

  1. Create some shell variables for directories (re-enter before doing steps of these directions after logging in)
    CLASS=<class-name>
    REPO=<full-base-path-for-repositories>
    WORK=<full-path-for-private-copies>
    TA=<TA-userid>
  2. Create a text file with all of the students usernames. These should be space-separated or one per line. Do not include yourself! Some later directions use this list to restrict permissions. If your userID is in there, you risk losing administration rights to your own directories, which may require sysadmin help to fix!
    mkdir $REPO
    # create list of students in $REPO/students.txt
  3. Create AFS groups for students.
    pts creategroup $USER:$CLASS
    pts adduser -group $USER:$CLASS -user $(<$REPO/students.txt)
  4. Create and set permissions for main repository directory (in a publicly accessible location)
    fs sa -dir $REPO -acl system:anyuser none $USER:$CLASS read $TA write
  5. Create template repository, and turn off class access.
    git init --bare $REPO/TEMPLATE.git
    find $REPO/TEMPLATE.git -type d -exec fs sa -acl $USER:$CLASS none -dir '{}' +
  6. Put some initial content into the template
    mkdir $WORK
    cd $WORK
    git clone $REPO/TEMPLATE.git
    cd TEMPLATE
    echo "This is your class submission repository" > README.txt
    git add .
    git commit -m "Initial commit"
    git push --all
  7. Copy template to rest of students and restrict access
    cd $REPO
    for i in $(<$REPO/students.txt); do \
      git clone --bare TEMPLATE.git $i.git;
      find $i.git -type d -exec fs sa -acl $i write $USER:$CLASS none -dir '{}' +;
    done
  8. Adding a new student
    STUDENT=userID
    cd $REPO
    pts adduser -user $STUDENT -group $USER:$CLASS
    echo $STUDENT >> students.txt
    git clone --bare TEMPLATE.git $STUDENT.git
    find $STUDENT.git -type d -exec fs sa -acl $STUDENT write $USER:$CLASS none -dir '{}' +
  9. Checking out all student directories
    cd $WORK
    for i in $REPO/*.git; do git clone $i; done
  10. Adding new content to the template
    cd $WORK/TEMPLATE
    # sample of content to push
    mkdir assn{1,2,3,4,5,6}
    touch assn{1,2,3,4,5,6}/.gitignore
    # probably would want to add more actual content
    git add .
    git commit -m "new assignment content"
    git push
  11. Pushing new template content to students
    cd $WORK
    for i in $(<$REPO/students.txt); do 
      (cd $i; git pull; git pull ../TEMPLATE master; git push)
    done