Encode your private RSA key $ cat my_private_key | base64 -w0 # -w0 to avoid newlines Add the base64 string to your project variables. Use it in your .gitlab-ci.yml ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d) No headache !