An Introduction to Gitlab

Gitlab is a web-based Git repository manager similar to Github. In the School of Computer Science & Informatics a Gitlab Community Edition server is available for students and staff. This page introduces the core features of Gitlab to enable you to use it effectively for your studies.

Logging In

The School's Gitlab server can be accessed by pointing your web browser at https://gitlab.cs.cf.ac.uk. All students and staff within the School can sign in using their standard university name and password by selecting the LDAP tab in the Sign in box.

If you have not logged in previously the Welcome to Gitlab! page will be displayed.

By default all users are given the rights to create 10 projects. If you require more than this please contact one of the Systems Managers.

Creating a Project

To create a new project click on the + icon in the top right toolbar.

Give your project a name in the Project path field and an optinal description stating the purpose of the project.

You can also select a visibility level for the project. By default the project is private meaning it is only visible to you. You can add members to the project at a later stage to allow them commit to your repository. It is advisable to make your project private.

Click on Create project to have your project initialised.

You will be taken to your project's homepage. On the left hand side is the project navigation at the moment there is no files option as we have not yet committed any files to the repository.

Scroll down and there are a set of instructions for creating a new repository or pushing an existing folder or Git repository to Gitlab.

Before you can push anything to your project you will need to add an SSH key to you profile.

Adding an SSH Key

Click on the gear icon in the top right hand toolbar to open your profile page.

Click on SSH Keys in the left hand menu.

If you already have a public/private key pair generated then you can miss out the following step.

Generate a public/private key pair by running the following command in a terminal:

ssh-keygen -t rsa -b 4096

Accept the default location to save the key by pressing Return and enter a passphrase if you wish. If you choose to use a passphrase you will have to type this each time you wish to use the key or run an authenatication agent see Configuring Passwordless Login on Linux for details on how public/private keys work.

Once you have a public/private key pair copy the public key. You can do this in a terminal by running the following command:

cat ~/.ssh/id_rsa.pub

Copy the outputted text which should start with ssh-rsa.

Alternatively you can copy the public key to the clipboard from within the terminal itself. If you are on Windows (in the same directory as your public key):

clip < id_rsa.pub

On macOS:

pbcopy < id_rsa.pub

And on Linux (note that you may need to install xclip using your package manager):

xclip -sel clip < id_rsa.pub

Now click on Add SSH key to add your SSH key to your Gitlab profile.

Give your SSH Key a name so that you can easily identify it in the future.

Paste the public key details into the Key field.

Click Add key to save your key into your profile. You can add multiple SSH keys by repeating the above steps.