Gitlab
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
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 theC
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.
In your user
directory a folder called .ssh
is made with two files.
id_rsa
: this file contains the private keyid_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.
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
If all goes well, the SSH Key will be stored in your settings.
You are now ready to use GitLab without entering your username and password on every interaction.