Я пытаюсь развернуть свой проект из Gitlab на моем сервере, используя gitlab CICD. Я могу успешно войти на удаленный сервер через локальный компьютер с помощью ssh, но не могу войти на компьютер при попытке скопировать мой проект через gitlab ci на удаленный сервер.
Я установил свои открытые ключи всервера и добавили закрытый ключ к переменной SSH_PRIVATE_KEY.My yaml file.
before_script:
- apt-get update -qq
- apt-get install -qq git
- "which ssh-agent || ( apt-get install -qq openssh-client )"
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- touch ~/.ssh/known_hosts
- ssh-keyscan -H ip >> ~/.ssh/known_hosts
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
deploy_stage:
stage: deploy
environment: Staging
only:
- master
script:
- ls
- scp -vvv -o StrictHostKeyChecking=no -P 1157 -r * user@host
"Журнал ошибок."
debug1: Offering public key: /dev/fd/63 RSA SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxx agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue:
debug1: Trying private key: /root/.ssh/id_rsa
debug3: no such identity: /root/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ecdsa
debug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ed25519
debug3: no such identity: /root/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /root/.ssh/id_xmss
debug3: no such identity: /root/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method