Using GitHub for assignments

Guidelines for SOFTENG 206, SOFTENG 281, and MECHENG 270

These instructions are provided to help you use Git (via GitHub) in this course.

Follow these instructions carefully:

  1. Using Git throughout the assignment
  2. Sign Up to GitHub
  3. Accept assignment invitation and clone the repository
  4. Using Git at the command line
  5. Checking the commit worked correctly
  6. Using a GUI client (not recommended)


1 Using GitHub throughout the assignment

If you are not making frequent commits to GitHub, you may be penalised!

How frequent should you be committing?
A good guideline is to make a commit for every significant change or progress you make, such that you are able to write a meaningful commit message for it.

For the academic purposes of this course, you need to demonstrate (through the commit history) the process you followed in coming up with your final solution. Therefore, make sure there are no massive gaps in your trail of commits.

Further to this, frequent commits will protect you in a number of ways:

Do not swap around between different GitHub accounts for assignments in the same course.



2 Sign Up to GitHub

First thing’s first. If you don’t already have an account to GitHub, you will need to create one.

If you already have a personal GitHub account, you can just use that — no need to create a new one.

Sign up to GitHub.

Whatever GitHub account/username you use for the first course activity, stick to it!

Don’t use a different account or username for subsequent assignments, otherwise this will cause issues when it comes to grading your work.



3 Accept assignment invitation and clone the repository

Your lecturer will share with you an invitation link for GitHub Classroom. Each assignment will have its own invitation link.

The first step involves cloning the GitHub assignment to your own account. This will create a private copy of the code provided by the lecturer, and will add it to your own GitHub account.

  1. Click on the assignment invitation link provided by your lecturer.

  2. If this is the first time you access this course’s GitHub invitation, you might be asked to select your name from the course roster. Select your name/identity if prompted. If you don’t find your name (despite it being the first time you access a GitHub Classroom invitation link), let your lecturer know so they can link your account to your name.

  3. Click the Accept this assignment button as shown below:

  4. You will see the following processing taking place, wait for it to complete:

  5. When you see the following page, click the URL of the cloned repository as shown below:

  6. If you see the following page, you have successfully cloned the assignment to your own GitHub repository:



4 Using Git at the command line

It’s recommended to use the command line to make commits to your GitHub repository.


Installing Git

First, you will need to install the git command line tool. There are plenty of tutorials online to do this, depending on your operating system.


Configuring Git (first time usage)

The first time you use Git at the command line, you might need to configure your username, password, etc. Again, Google is your best friend. But in a nutshell, you will need to:

  1. Set up your user name and email at a glance (Chapter 8.1), or for more details see:
  2. Create a personal access token (PAT), and then
  3. Use Git Credential Manager to cache the PAT (select your OS from top of page).


Let’s use Git!

Go to your GitHub repository page:

  1. Press the Code button.

  2. Click on the clipboard icon to copy the URL.

  3. Determine where on your computer you would like to store your repository. Go to that folder.

  4. Type the following command, using the URL you got from the earlier step above:

    git clone URL-TO-REPO

  5. If all goes well, you should be able to see a new folder (with the name of your repository). This folder is known as the “local repository”, which effectively is your local copy of the (otherwise remote) repository that is stored on the GitHub server.

  6. When you edit your code, or add a new file, you will need to “stage” (a Git term) these files to be ready to push to the repo.

  7. You should double check that the commit was pushed to the remote repository correctly.



5 Checking the commit worked correctly

If you want to double-check the commit went through to GitHub correctly, do the following.

  1. From your GitHub assignment repository, click on the commits link:

  2. You should be able to see the commit details listed here also:



6 Using a GUI client [not recommended]

We mention this option as you might come across it. However, we discourage you from using such GUI tools or IDE plugins to manage your Git repositories.

Such tools abstract away a lot of important concepts, and in the long run are not helping you learn what is going on.

A Git GUI client is an alternative to using the command line to push your commits. There are plenty of options here, depending on your operating system and personal preferences. For example, you might come across GitHub Desktop, or other plugins that integrate into the popular IDEs.

As stated above, we recommend you stick to the command line option.