I was trying to deploy the master branch via ssh, but after following the steps: https://medium.com/@hfally/a-gitlab-ci-config-to-deploy-to-your-server-via-ssh-43bf3cf93775 got:

my script:
before_script:
  - sudo apt-get update -qq
  - sudo apt-get install -qq git
  # Setup SSH deploy keys
  - 'which ssh-agent || (sudo apt-get install -qq openssh-client )'
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SSH_PRIVATE_KEY")
  - mkdir -p ~/.ssh
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    
deploy_staging:
  type: deploy
  environment:
    name: staging
    url: serverIp
  script:
    - ssh -t -t user@serverIp "cd var/www/ && git checkout master && git pull origin master && exit"
  only:
    - master
Yes, I already generated a private ssh key, saved it in the SSH_PRIVATE_KEY variable, I went to ~/.ssh/authorized_keys and put the public key there, I already entered the server on which Runner is installed and gave ssh user@serverIp and entered, but in the pipeline it always generates this error, I even considered putting ssh-keygen in the pipeline, but because input is needed, it didn't work
NOTE:
- I changed the real ip for "serverIp" and the user just to illustrate
- I don't speak English, so I used Google Translate, it may be that the text got confused.
 
     
    