"Host key verification failed." on Gitlab_ci when running "ssh name@server"
Here's a part of my gitlab_ci which is supposed to login to my server and run scripts from the repo:
script:
  - which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
  - eval $(ssh-agent -s)
  - ssh-add <(echo -e "$SSH_PRIVATE_KEY")
  - echo "debug"
  - echo "$SSH_PRIVATE_KEY" # all is ok here, it'll be printed
  - echo "debug"
  # - here comes an error
  - (cat ./script/script1.sh) | ssh -t -t $SSH_USERNAME@$SSH_HOST
And the errror:
  Host key verification failed.
  ERROR: Job failed: exit code 1
Why the error? The variables are set.
The private key does work when I'm doing the same thing manually from my local computer and Gitlab.
 
     
     
    