Hide menu

TDDE45 Software Design and Construction

Getting started with Git and GitLab

Introduction

An essential tool for the lab series is Git, a distributed version control system. It is assumed that you are familiar with Git and its terminology. In case you are not, we have collected a number of useful references that will easily get you started:

  • Pro Git — A free book available on Git’s official website. Chapters 2.1–2.4 are highly recommended.
  • Try Git — Got 15 minutes and want to learn Git? An interactive introduction to Git.
  • Git Magic — Rough instructions for particular effects. Available in many languages.
  • Git How To — A guided tour that walks through the fundamentals of Git, inspired by the premise that to know a thing is to do it.
  • Git Cheatsheet — A handy reference for Git commands.
  • Learn Version Control with Git — A step-by-step course for the complete beginner.

In this course, the management of Git repositories is done using a web-based platform called GitLab, which is deployed on one of LiU’s servers (Note: Do not use gitlab.ida.liu.se). You should be able to access LiU’s GitLab using your LiU ID.

Getting access to labs

We have chosen to make the gitlab repositories private in order since this makes forks private as well (so you don't accidentally share the repository).

Request access to the TDDE45-student repository. Contact your lab assistant or the examiner if you do not get access to the labs after requesting it.

Checking your SSH keys

Please set up SSH keys in accordance with GitHub’s or GitLab’s manual; either one should work with these projects.

  • GitHub Manual — Follow steps one and two, and after this you will need to copy the content of your newly generated ida_rsa.pub to a GitLab SSH key.
  • GitLab Manual — A video tutorial by the GitLab team.

What are SSH keys?

SSH keys are a way to identify trusted computers without involving passwords. The main advantage, except for not having to supply your password every time, is that your password is actually never sent over the network, and thus it is a bit safer.

Setting up your group

The goal is to create a single group that you invite your lab assistant to (who can see all your code and easily leave the group at the end of the course). The final structure should look something like:

Creating a group

Go to New group to create a Private group called TDDE45-2023-LIUID1-LIUID2 for your lab pair. Invite your lab partner (give him or her the master role) and lab assistant (reporter access or above is sufficient; guest is not) to this group.

Forking a repository

Go to the lab assignment you want to work on (e.g. lab1. There is a button called Fork; in the next screen choose the group to fork into. Do not create a new repository with the same files as the actual; use forking instead.

You will need a local copy to work on at some point, so we clone this from the repository (there will be a button called Clone that contains the following command or similar):

  home$ git clone http://gitlab.liu.se/TDDE45-2023-LIUID1-LIUID2/LABXXX.git
    Cloning into 'LABXXX'...
    Username for 'http://gitlab.liu.se': <YOUR_STUDENT_ID>
    Password for 'http://<YOUR_STUDENT_ID>@gitlab.liu.se': <YOUR_STUDENT_PASSWORD>
    remote: Counting objects: 3084, done.
    remote: Compresseing object: 100% (1765/1765), done.
    remote: Total 3084 (delta 1249), reused 3084 (delta 1249)
    Receiving objects: 100% (3084/3084), 44.38 MiB | 392.00 KiB/s, done.
    Resolving deltas: 100% (1249/1249), done.
    Checking connectivity... done
    Checking out files: 100% (2171/2171), done.

If you need to share a certain repository with other members of your 6-student team (as indicated by the lab instructions), you can invite them on a per-repository basis. You can create a Team for the other members to make it easier to invite them multiple times.

Recommended reading

For a more extensive introduction to branching and Git, please see git-scm.com if you would like to dive deeper into how Git works and how to work with it.

Page responsible: Adrian Pop
Last updated: 2022-08-13