This blog will help you to setup a SSH connection between Jenkins and Gitlab.
- Jenkins Server
- Gitlab Server
Run on Jenkin Server
sudo -su jenkins
ssh-keygen eval $(ssh-agent -s) ssh-add ~/.ssh/id_rsa
Go to Gitlab setting -> SSH Keys -> paste the key
Jenkins ->Credentials -> Add Crdentials -> SSH username with private key