0

I want to create a gitlab pipline that automatically deploys a built folder to a server via ssh. I have found a few snipets on the internet and adapted them. However, I get a permission error:

Using docker image sha256:31c774f62a9b520060d72c3c1901facdfdfd0fc4ae7c5... 
for docker:19.03.5 with digest docker@sha256:0b90b0aefd15794e4d5bea2debc3b7... ...

$ mkdir -p ~/.ssh
$ echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
$ chmod 600 ~/.ssh/id_rsa
$ [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

$ echo -e "ssh hello@www123.yourserver.de"
ssh hello@www123.yourserver.de
$ echo -e "ls -l"
ls -l
$ echo -e "exit"
exit

$ echo "Deploying application..."
Deploying application...
$ scp -r dist/* hello@www123.yourserver.de:/usr/home/hello/public_html/development/frontend/app/
Warning: Permanently added 'www123.yourserver.de,xx.xx.xxx.xxx' (ED25519) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
hello@www123.yourserver.de: Permission denied (publickey,password).
lost connection
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit code 1

Even an upstream attempt to connect to the server from the GitLab pipeline via SSH didn't really work (see console output). I wonder what I did wrong?

Max Pattern
  • 1,430
  • 7
  • 18

0 Answers0