Gitlab - failed to authenticate remote server for CI and CD build

后端 未结 2 1173
时光说笑
时光说笑 2021-01-06 16:45

I am getting \"Enter passphrase for /dev/fd/63\" error when my \".gitlab-ci.yml\" tries to remote to my Ubuntu server for executing SSH com

2条回答
  •  天命终不由人
    2021-01-06 17:11

    I use the below snippet to ssh using .gitlab-ci.yml job, STAGING_SSH_KEY is stored as a variable under Settings -> CI/CD -> Variables

    variables:
        GIT_SSL_NO_VERIFY: "true"
    
    image: someimage:latest #replace with any valid image which has ssh installed
    
    before_script:
      - mkdir -p ~/.ssh
      - echo -e "$STAGING_SSH_KEY" > ~/.ssh/id_rsa
      - chmod 600 ~/.ssh/id_rsa
      - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    
    stages:
     - deploy
    
    deploy_STAGING_job:
      stage: deploy
      script:
       - echo "ssh into the below random IP"
       - ssh myuser@10.200.200.200"
         echo "Login using ssh to remote instance"
         "
    

提交回复
热议问题