Using Git

Submitty supports utilizing Git for handling submissions by students. When a student hits “submit”, Submitty performs a clone of their repository. Submitty then does a checkout of the last revision made before the timestamp of when they hit the submit button.

To configure Git for an assignment, you will want to select type “Students will submit by committing files to a version control system (VCS) repository”, and then chosing the option that suits your needs.

Submitty comes with a setup for an internal Git server out of the box, but if you wish to use an external source, such as Github, you may need to configure Submitty to be able to access those repos via SSH. See System Administrator/Setting Up Git for more details.

Assignment Creation

Text fields in the VCS Repository Details section support the following list of “variables” which get replaced during execution of Submitty:

There are multiple different options for students submitting files from version control.

If this is a team assignment, encourage the students to form their teams through the Submitty interface promptly, so they are not delayed by the creation of their team version control repository.

If the students files will be in a subdirectory of their main repository, select “yes” and put the path to the student’s files in the required field.

Generating Submitty Server Version Control Repositories

Once you have created the gradeable, you may create empty repositories for each student/team for that assignment if you are using the Submitty hosted VCS repositories. The provided script creates a bare shared repository with restricted permissions.

The script accepts a --help flag to explain the arguments it accepts. The basic usage:

sudo /usr/local/submitty/bin/ <semester> <course_code> <project_name/gradeable_id>

NOTE: In order to use this script, instructors for courses needing repositories should be given limited sudo access to run this script.

If the third argument is not an existing gradeable_id, the user is prompted to confirm to make these repositories. If confirmed, an empty repository is made for every user in the course. If it is an existing gradeable, the script checks to see if this gradeable is an individual or team assignment. If it is an individual gradeable, an empty repository is made for every user. If it is a team gradeable, an empty repository is made for every team that has been formed so far. The script can be re-run when additional teams are formed.

Permissions on these repositories (which is handled automatically by the generate script) is that these directories and files must be readable and writeable by www-data or else students won’t be able to clone/push/etc.

All repositories are stored under /var/local/submitty/vcs/git.

Cloning Your Repositories

After the instructor has created the git repositories, your students and you can checkout their repositories from the following http(s)://GIT_URL/git/<semester>/<course>[/<gradeable_id>]/user_id.

access restricted to the student (or members of the team), the instructor(s), and the full access graders.

Public Repositories (e.g., Github)


Private, Student-Created Repositories (e.g., Github)


External, Private, Instructor-Created Repositories (e.g., Gitlab or Github Classroom)

NOTE: Your Submitty server will need access to the student’s repositories, whether that be adding a SSH key for private repositories, or having public repositories.

  1. Create a group/organization with a simple name (e.g. cptr101. This part can be skipped if using the instructor’s repositories.)

  2. Create a project within that group/organization with a simple name (e.g. student101)

  3. Clone the repository to your local IDE, and add your assignment(s).

  4. Create the course (if not already set up).

  5. Create the gradeable, selecting the proper gradeable type, in the required field, type the SSH clone link, but replace your user id with {$user_id}. E.g.,{$user_id}/student101.git

  6. Give your students the URL to the repository, and instruct them to fork it.

NOTE: Students user ids in Submitty need to be the same as your VCS system.

Uploading Instructor Provided Code to GIT

  1. First, generate the repos as directed above. clone/download the following script:

  2. Then, to distribute instructor-provided code, clone/download the following script:

    GIT Provided Code Script

  3. Prepare a simple text file (e.g., students.txt) with the usernames of all of your students. One username per line.

  4. Prepare a directory with the files you would like to provide to each student.

  5. Run the script:

    python3  <server> <semester> <course> <repo/gradeable> <path to provided code> <initial commit message> <student usernames file>

    For example:

    python3  ~/Submitty/GIT_CHECKOUT/InstructorTools/GitProvidedCode/ s19 csci1200 hw1 ~/teaching/s19/hw1/src 'provided hw1 code' ~/teaching/s19/students.txt

    IMPORTANT: Note that without a trailing slash on the provided code directory ~/teaching/s19/hw1/src, the src directory and its contents will be added to the repositories.

    With the trailing slash (~/teaching/s19/hw1/src/) the src directory will NOT be added to the repository, only the contents of the src directory will be added to the repositories.

  6. This script will create a directory structure in the current directory for the specified repository/gradeable, clone each student repository, create a provided branch, and add the files to that branch.

    If a file has been removed from the provided code directory, it will be removed from the branch in the repository.

    If the repository does not yet contain a master branch, it will be created and the code from the provided branch will be copied/merged into the new branch. If the master branch already exists, it will not be modified. All other branches are unmodified.

See also: Student: Assignment Submission via GIT

See also: System Administrator: Setting up Internal Git