Connect to gitlab by ssh (Linux)

Preparation – Linux computer

First of all, a ssh key is required. Generate a key par with this command:

ssh-keygen -t rsa -b 4096 -C "user@codesie.ch"

The key pair should be located here:

~/.ssh/

Copy the content of the public key file: id_rsa.pub.

Configure gitlab

Login with your user and go to Settings -> SSH Keys and paste the content of the public key in the intended input field and click “Add key”

Testing the connection

ssh -T git@gitlab.com
Welcome to GitLab, @your_username!