Working on assignments with GitHub and Gradescope

Huge thanks to Ben Wiedermann at HMC for sharing the following.

Jo Hardin https://m154-comp-stats.netlify.app/ (Pomona College)https://hardin47.netlify.app/ , original content by Ben Wiedermann (Harvey Mudd College)

Working on assignments with GitHub and Gradescope

In Math 154, we will use GitHub + Gradescope to access and submit assignments. Here is the basic structure of how it will work:

  1. Get the assignment materials from GitHub classroom.
  2. Clone the repository to any machine you are using.
  3. Work on the assignment and push back to GitHub.
  4. Submit the assignment on Gradescope.

The following diagram lays out the process, and the rest of the document provides a more detailed set of instructions.

Flowchart demonstrating that assignments are recieved from Git, processed on your computer (iteratively with GitHub), and submitted to Gradescope.

Figure 2: Flowchart of assignment process.

Installing R + RStudio + Git

Most importantly, please become familiar with Happy Git and GitHub with R. Happy Git with R is an incredibly user friendly resource which includes help for almost every single thing that might happen when getting started.

  1. The first step is to install R + RStudio + Git on your machine. (If you are planning to use Pomona’s RStudio server, R + RStudio + Git are all three already installed for you.)

  2. Create an account on GitHub (if you already have one, use it!).

  3. Introduce everyone: R + RStudio (should happen automatically); yourself to GitHub (see https://happygitwithr.com/); RStudio + GitHub (see https://happygitwithr.com/).

  4. Follow the rest of the steps that Jenny Bryan spells out in Happy Git and GitHub with R. Most likely, you only need to work through step 12. Step 15 is detailed below after you have gotten the assignment from GitHub.

Screen shot of the Happy Git with R webpage.

Figure 3: The more you read Happy Git with R, the better your life will be.

Get the assignment materials from GitHub Classroom

Each assignment will be provided as a link to GitHub classroom. Click the link. (The link will come to you via an email from Sakai. If you lose the email, or the email goes to your spam folder, check Sakai messages for the assignment link.)

The first assignment will be an individual assignment. Some other assignments will be paired or group assignments. To accept an individual assignment, click the “Accept this assignment” button.

For all joint assignments, you will need to create a team before you can start.

Screen shot of GitHub showing where to accept the assignment.

Figure 4: Accept the assignment to create a different repository for every assignment.

The assignment files will be copied as a private repository that you (and your partner, if applicable) and the course staff have access to.

We will call this version, that lives on your personal GitHub account the GitHub fork.

Clone the assignment (or project) repository on to your own computer(s)

Once your repository has been created, you should clone the code to whatever computer you are working on. Just like a Google Doc, you can work on the files from different machines at different times. Unlike a Google Doc, you’ll have to make sure to open the repo (clone or pull if you’ve aleady cloned) and save the repo (commit + push) more deliberately.

  1. Click on the link for the repository.
Screen shot of GitHub showing the new assignment repo.

Figure 5: Clink on the link to your assignment repository to get started.

  1. Click the Clone or download button and copy the URL.
Screen shot of GitHub showing the location of the repo URL.

Figure 6: Copy the HTTPS URL, and use it to create a new project in RStudio.

  1. On the cloning machine (e.g., your own compute or the RStudio server), create a new R project with the URL copied from above. Follow the steps at https://happygitwithr.com/new-github-first.html (section 15.2 New RStudio Project via git clone).

Work on the assignment, push back to GitHub

All of the GitHub interaction will take place through the RStudio IDE. The two important steps for getting the assignment back to GitHub are:

pull

If you are working with a colleague or on different machines it is so incredibly important to get in the habit of immediately clicking on pull when you start your work. (If you are working alone on a single machine pull won’t hurt! You’ll just be told that your files are already up to date.)

Screen shot of how to pull using the Rstudio IDE.

Figure 7: Always pull before you start. pull-work-save-commit-push

knit your work

Don’t forget to put your name on the assignment. Also, make sure that you knit to pdf. Knit early and often. The more often you knit, the fewer headaches you will have.

Screen shot of how to knit using the RStudio IDE.

Figure 8: Always pull before you start. pull-work-knit-commit-push

commit your work

You don’t need to commit every file, but you do need to commit files that are integral to the analysis (always commite .Rmd, .pdf, data files, images that created the pdf, etc.).

Screen shot of how to commit using the RStudio IDE.

Figure 9: pull-work-knit-commit-push

push your work to GitHub

It is good practice to use meaningful commit messages to help your future self figure out your past work.

Screen shot of how to push using the RStudio IDE.

Figure 10: pull-work-knit-commit-push

check your work on GitHub

To make sure that the work went through, always check your GitHub repo online to confirm any changes you made.

Screen shot of checking GitHub changes online.

Figure 11: Check that your changes are correct.

Submit the assignment on Gradescope

You will submit your assignments via Gradescope. To submit your assignment, complete the following steps:

  1. Access the course’s Gradescope site, select the appropriate assignment, and then choose GitHub as the submission method. You must access the course’s Gradescope site via the side menu in Sakai.
Screen shot of Gradescope connection from inside Sakai.

Figure 12: Access Gradescope via Sakai.

  1. The first time you submit your repository, you will need to authorize Gradescope to access your git repository. Select the appropriate repository and branch (branch will almost always be main).
Screen shot of Gradescope instruction to submit via GitHub.

Figure 13: Submit files directly from GitHub.

  1. If this is a pair-programming submission, you will need to associate all team members with the submission. After you upload your files, click “Add Group Member” and add your partner to the submission. Add your team member to your Gradescope submission

You can submit multiple times before the deadline. Your last submission will determine your grade.

Once assignments are completely graded, you will be able to see your grade and assignment feedback on Gradescope. Grades will also be synched with Sakai.

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/hardin47/m154-comp-stats, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".