1

I have problem with my autodeploy on gitlab-ci. I want send files from docker run on runner to remote host (my site hosting). My .gitlab-ci.yml is like this

variables:
# STAGING CONFIGURATION
  STAGING_USER: "[email protected]"
  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/

But when I try with this configuration I getting error

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

I don't have idea how configure this correctly. I must auth via sshpass because my server don't allow rsa auth.

2 Answers 2

1

In the manual page for sshpass I found this example:

rsync --rsh='sshpass -p 12345 ssh -l test' host.example.com:path . 

https://linux.die.net/man/1/sshpass

Sign up to request clarification or add additional context in comments.

Comments

0

You need to put the rsync ssh shell parameter into quotes:

rsync -hrvz -e "sshpass -e" theme/ $STAGING_USER:~/test/

1 Comment

Thanks for answer but this isn't work for me. Now I getting error like this. sshpass: invalid option -- 'l' protocol version mismatch -- is your shell clean? (see the rsync man page for an explanation) rsync error: protocol incompatibility (code 2) at compat.c(178) [sender=3.1.2] Maybe you have other idea for this problem ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.