我在 gitlab-ci 上的自动部署有问题。我想将文件从 docker run on runner 发送到远程主机(我的站点托管)。我.gitlab-ci.yml
的是这样的
variables:
# STAGING CONFIGURATION
STAGING_USER: "test@test.com"
STAGING_URL: "test.com"
# $STAGING_SSH_PASSWORD - configure in gilab->settings->CI/CD->variables
# image with php an
image: webdevops/php-apache-dev:5.6
before_script:
- apt-get update -qq && apt-get install -y -qq sshpass
- apt-get install zip unzip
- apt-get install -y ssh
- mkdir ~/.ssh
- echo "StrictHostKeyChecking no" >> ~/.ssh/config
- apt-get install -y rsync
# DEPLOY STAGING
DEPLOY_STAGING:
stage: deploy
only:
- master
script:
- export SSHPASS=$STAGING_SSH_PASSWORD
- rsync -hrvz -e sshpass -e theme/ $STAGING_USER:~/test/
但是当我尝试使用这种配置时,我得到了错误
rsync: Failed to exec theme/: Permission denied (13)
rsync error: error in IPC code (code 14) at pipe.c(85) [Receiver=3.1.2]
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [Receiver=3.1.2]
ERROR: Job failed: exit code 1
我不知道如何正确配置它。我必须通过 sshpass 进行身份验证,因为我的服务器不允许 rsa 身份验证。