SSH

Generate ssh-key

ssh-keygen -t ed25519 -C "Ansible default"

Copy key to the server

ssh-copy-id -i ~/.ssh/yourkey.pub Ip_of_your_server

Login to server with key

ssh -i ~/.ssh/yourkey Ip_of_your_server

a better way to do it is to add a config so you don’t have to specify the file every time. vim ~/.ssh/config add to the file:

Host Ip_of_your_server
    HostName Ip_of_your_server
    User Username_on_Server
    IdentityFile ~/.ssh/yourkey

Add ssh-key to GitLab

First of you dont want to reuse the key on multiple servers or instances so make a spesific key for gitlab first.

Go to your preferences on GitLab

On the left side you should see the SSH keys

Cat out your key cat ~/.ssh/gitlab_key.pub copy the whole string, paste in your key and add a title and preferebly a expiration date.