# Gitlab (deprecated)

GitLab is a web-based Git repository manager with wiki and issue tracking features, using an open source license, developed by GitLab Inc.

At VIVES we have your own private GitLab server at [git.labict.be](https://git.labict.be)

An account to GitLab is provided to you by your teachers. Check you mailbox with more details about your account. If for some reason you have problems signing in on GitLab contact your teacher.

## public key authentication

When interacting with GitLab you have the option to enter your username and password every time. Because these interactions add up over time, entering username and password will take alot of your precious time.

A better solution is to make use of _public key authentication_. In this way you don't need to provide your username and password with every interaction. PK authentication has more benifits over password authentication. For example it inheritly makes use of encryption and is far more dificult to hack.

## Generating a private and public key

First we need to generate a private and public key pair. The private key is a key that needs to stored on the machine you want to use to interact with GitLab. This key is private and should never be shared with someone. Sharing this key is the same as sharing your password. The public key can be know by everyone. So it safe to store the key on GitLab.

Generating a random key can be done with the `ssh-keygen` command. The command needs two extra options.

* `-t`: Type, we need an RSA key
* `-C`: Comment, add your name and machine name with the `@` notation. Eg: sille@laptop. **NOTE that the** `C` **option is in capital letters !**

```
ssh-keygen -t rsa -C yourname@machine
```

The command will ask for some extra questions. You should leave the default values by simply pressing `ENTER`. Keep the default installation path and do not use a password.

![](https://981283853-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEK-j-hxx7zCDNXfjra%2F-LL4EVa4libM96oMBXqa%2F-LL4EXMau3i8K2OGH4mR%2Fssh-keygen.png?generation=1535538777039003\&alt=media)

In your `user` directory a folder called `.ssh` is made with two files.

* `id_rsa`: this file contains the private key
* `id_rsa.pub`: this file contains the public key

## Adding your public key to your GitLab account.

Log in into GitLab account and go to your settings page.

![](https://981283853-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEK-j-hxx7zCDNXfjra%2F-LL4EVa4libM96oMBXqa%2F-LL4EXMcBkTzzfy8gY4j%2Fstep01.png?generation=1535538768081246\&alt=media)

![](https://981283853-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEK-j-hxx7zCDNXfjra%2F-LL4EVa4libM96oMBXqa%2F-LL4EXMe7zMTXW4F-o0r%2Fstep02.png?generation=1535538777024726\&alt=media)

In the menu search for "SSH Keys" and open the tab/page.

Open your public key file with any simple text editor to copy the key string. (use notepad or preferable Visual Studio Code) Paste your **public key** in the textbox and add a title. A good title is your name combined with the machine name in the `@` notation. For example: sille@laptop

![](https://981283853-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEK-j-hxx7zCDNXfjra%2F-LL4EVa4libM96oMBXqa%2F-LL4EXMg5m36WogV9H9A%2Fstep03.png?generation=1535538777074129\&alt=media)

If all goes well, the SSH Key will be stored in your settings.

![](https://981283853-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEK-j-hxx7zCDNXfjra%2F-LL4EVa4libM96oMBXqa%2F-LL4EXMiDHv1Ljlg5fYl%2Fstep04.png?generation=1535538777560465\&alt=media)

You are now ready to use GitLab without entering your username and password on every interaction.
