Working with GitHub

Log on to CPEN 331 UBC GitHub organization.

If you don't have an account with UBC GitHub, create one. Log on to CPEN GitHub.

Create OS161 code repository

  1. Click on the New button to create a new repository.
  2. Under Repository template select CPEN-V-331-101-V2024W1/template-os161-1.99.08. Make sure that the Repository Owner is CPEN-V-331-101-V2024W1.
  3. If you are creating a repository for assignments 1-3: For Repository name type individual-CWL, replacing the bold letters with your CWL. For example, if your CWL is speedykangaroo, your repository name will be: individual-speedykangaroo.
  4. If you are creating a group repository for assignments 4-6: For Repository name type group-CWL1-CWL2, replacing the bold letters with the CWLs of you and your partner in alphabetical order. For example, if your CWL is speedykangaroo and your partner is dashingcheetah, your repository name will be: group-dashingcheetah-speedykangaroo.
  5. Once you created the group repo, you will need to invite your partner as the collaborator. To do that, while on your repository page, click on the Settings cogwheel icon at the top right, then click on the Collaborators at the menu on the left, click on the green button =Add people and find your partner by their CWL id.
  6. Make sure your repository is private. We will not grade public repositories. Click Create.
If you make a mistake in naming your repository we will not be able to find it and grade it, so make sure the names are correct. If they are not, delete the repository and make a new one with the correct names.

Prepare to access your repository

On the next screen, if you click on Code button, GitHub will show the URL that you will use for cloning the repo on your computer. Use the SSH option. For example, for your speedykangaroo repository, your URL will be git@github.ubc.ca:CPEN-V-331-101-V2024W1/individual-speedykangaroo.git. You will be accessing your repo from your laptop or from the department server, and you will need to set up SSH access to it. Click here to learn how.

Clone your repository

Using the URL obtained in the previous step, you can now clone your repository to your local machine as follows. Open a shell, go to any directory where you'd like to keep your work, we will call it /home/OS_BASE, and run:
git clone  src
You can create multiple clones of your repositories, which you might want to do if you are using different machines to do your work. Just remember to always commit and push your code periodically, so you don't lose it in the event your local disk crashes and so that you can always access it from another clone. Committing and pushing your work is described here.

Additional configuration

Finally, to correctly track the user committing the code, run the following commands:

git config --global user.name "Your Name"
git config --global user.email "yourname@server.ca"

Merging conflicts

Read this tutorial to assist you in your first merge assignment.