Chapter 3: Programming Courseworks

Cloning a repo

face Josiah Wang Tom Crossland

A git repo for this mock exercise has been created for you on the DoC GitLab server.

Log into your GitLab account, and find the project named Lab_Introduction_USERNAME (you should also have been sent an email with a link to this repository).

In order to make changes to the repo, you must “clone” it into your home directory. This is just a fancy way of saying “download it” – but cloning comes with some extra advantages, like the ability to synchronise your local changes with the repo on GitLab.

To clone the repo, you will need to go to the GitLab project page, and find the “Clone” button.

Copy the link in the “Clone with SSH” field.

Now we’re ready to clone the repo. We do this with a command like:

username@MACHINE:~$ cd ~/modules/shell
username@MACHINE:~$ git clone git@gitlab.doc.ic.ac.uk:USERNAME/REPOSITORY.git

You will need to replace the git@gitlab.[...].git link with the one you copied from GitLab.

This will create a directory containing the repo content, inside the current working directory.

Exercise 5

  1. Find your “Clone with SSH” link for your mock exercise git repo.
  2. Clone the repo somewhere in your home directory.
  3. Use ls to check that the repo directory has been created.
  4. cd into the repo, and ls its contents.