ICS-E4020: Github workflow

Github workflow: basic

Step 1: Creating an account on GitHub

  1. Setup a GitHub account if you already do not have one: https://github.com
  2. Send an email with the subject “ICS-E4020 registration” with the following information to the teaching assistant (joel.rybicki at aalto.fi):

Step 2: Join the course organization

  1. Eventually, you should receive an invitation by email to join the course organization from GitHub. Accept the invitation.
  2. Once you have accepted the invitation, go to https://github.com/ICS-E4020 and verify that you see the two repositories exercises and solutions-YOUR-ACCOUNT listed on the page.

Step 3: Initialise your git repository

On your computer, run the following commands:

    $ git clone https://github.com/ICS-E4020/exercises.git
    $ cd exercises

We now setup git to use two remotes as follows:

    $ git remote rename origin upstream
    $ git remote add origin https://github.com/ICS-E4020/solutions-YOUR-ACCOUNT.git
    $ git push -u origin 

Alternatively, you can run the above commands the by executing the script ./setup-private-repo-sh.

Now the remote upstream should point to the read-only exercises repository and the remote origin points to your own private repository. During the course, you pull all exercise related material from upstream but submit your own solutions to origin.

After completing the above, check that

    $ git remote -v 

outputs the following:

    origin  https://github.com/ICS-E4020/solutions-YOUR-ACCOUNT.git (fetch)
    origin  https://github.com/ICS-E4020/solutions-YOUR-ACCOUNT.git (push)
    upstream    https://github.com/ICS-E4020/exercises.git (fetch)
    upstream    https://github.com/ICS-E4020/exercises.git (push)

Note: You can also use GitHub via ssh. In the following, simply replace everything starting with https://github.com/ICS-E4020/ with git@github.com:ICS-E4020/.

Step 4: Submitting exercises

  1. Read the README.md for the technical details.
  2. Use git add and git commit to commit any changes you have made as usual.
  3. After completing your assignment, remember to also git push your changes to your GitHub repository. Remember to do this! Otherwise, your solutions never reach the course staff and you will not get any points!

Step 5: Retrieving new exercises

Once a new set of exercises has been released, execute the following command:

    $ git pull upstream master

Github workflow: advanced

Step 6: Multiple repositories

In case you want multiple copies of your private repository (e.g. you're working on several machines), execute the following after completing Step 3:

    $ git clone https://github.com/ICS-E4020/solutions-YOUR-ACCOUNT.git
    $ git remote add upstream https://github.com/ICS-E4020/exercises.git


Never used Git before?

Read the Git tutorial first.

Using ssh with GitHub

Typing in your username and password gets old rather quickly. To remedy this, you can generate ssh keys and use them with GitHub:

  1. See the GitHub instructions on generating ssh keys.
  2. Configure your course git repositories to use ssh connections:
        $ git remote rm upstream
        $ git remote add upstream git@github.com:ICS-E4020/exercises.git
        $ git remote rm origin
        $ git remote add origin git@github.com:ICS-E4020/solutions-YOUR-ACCOUNT.git

Now git pull or git push should not ask you your password each time.