Using Github classroom for assignments

Requirements

  • Get a GitHub account. I recommend to use a username reflecting your name.
  • Install git on your development machine.

Setup github

git config --global user.name Surname Name
git config --global user.email you@provider.com

Generate a ssh key

This step is only necessary, if you do not want to enter your password each time you work on GitHub.

ssh-keygen -t rsa -C "you@provider.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/diehlpk/.ssh/id_rsa): ~/.ssh/id_rsa_github
ssh-add ~/.ssh/id_rsa_github

Copy the content of the ~/.ssh/id_rsa_github.pub and add it to your GitHub profile going to your Profile -> SSH keys and GPG keys -> New SSH key.

Working on your assignment

For each assignment you will get an e-mail and find the link to your assignment on the exercise sheet.

GitHub Logo

After clicking on the link you will get the url to your git repository.

GitHub Logo

Use the commands to checkout and submit your homework.

git clone https://github.com/diehlpkteaching/test-diehlpk.git
cd test-diehlpk
touch exercise.cpp
git add exercise.cpp
# Work on your exercise
git commit -a
git push

Note that you can commit and push your work as often as you want. I recommend commit and push often to save your work and have a history.

Video tutorial

asciicast

Also available on YouTube.