I have a Gitlab pipeline, in which I want to create a connection to a server with ssh:
stages:
- connect
connect-ssh:
stage: connect
script:
- mkdir ~/.ssh
- echo -e "$PROD_SSH_KEY" > file_rsa # SSH PRIVATE KEY
- echo -e "$PROD_SSH_PASSPHRASE" > passfile # PASSPHRASE
- chmod 600 file_rsa
- cat passfile | ssh-add file_rsa # DOESN'T WORK
- ssh -i $PROD_USER@$PROD_HOST
- pwd
$ cat passfile | ssh-add group-5_rsa
Could not open a connection to your authentication agent.
I have seen few answer, but they weren't appropriate with gitlab jobs. What solution do I have for this situation?