I try to sync my local files inside the folder named dist with the root folder of my ftp-account using .gitlab-ci.yml. While the job runs successfully, my ftp root folder remains empty.

I have created a ftp account, which has access to httpdocs only. I want my files to be copied inside httpdocs.

I am using this code to copy the files:

rsync -avh --delete --rsh="sshpass -p $PROD_FTP_PASS ssh -o StrictHostKeyChecking=no "  ./dist/ $PROD_FTP_USER@my.ftpserver.de/

The command logs the following:

sending incremental file list
created directory dev-git@my.ftpserver.de

          4.69K 100%    0.00kB/s    0:00:00  
          4.69K 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=18/20)

          6.41K 100%    6.12MB/s    0:00:00  
          6.41K 100%    6.12MB/s    0:00:00 (xfr#2, to-chk=17/20)

          2.06K 100%    1.97MB/s    0:00:00  
          2.06K 100%    1.97MB/s    0:00:00 (xfr#3, to-chk=16/20)

sent 62.95K bytes  received 423 bytes  126.74K bytes/sec
total size is 61.64K  speedup is 0.97
Job succeeded

I have read, that using dist/ or dist makes a difference. I do not want to copy the folder but it files. Although I want to place these files in the root directory of my ftp account (which is httpdocs/).

What am I doing wrong and where are the files being copied right now, as I cannot see them using my ftp account?

Another error message:

When I try to send data to a random path, I receive the following error:

$ rsync -avh --progress --delete --rsh="sshpass -p $PROD_FTP_PASS ssh -o StrictHostKeyChecking=no " ./dist $PROD_FTP_USER@my.ftpserver.de/httpdocs/yellowstorm
sending incremental file list
rsync: mkdir "/builds/fyd/fyd-presite/dev-git@my.ftpserver.de/httpdocs/yellowstorm" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(674) [Receiver=3.1.1]
ERROR: Job failed: exit code 1

The syntax for remote source/destination in rsync is [<user>@]<host>:[path] So minimally this must be example.com: ie the : is important.

Your remote does not have the : so rsync will be copying the files to a local directory called $PROD_FTP_USER@my.ftpserver.de (you can confirm by running an ls in the build plan) instead you should use $PROD_FTP_USER@my.ftpserver.de:/ this will copy into the root of the remote (the servers root not the ftp root since you are using ssh). Or $PROD_FTP_USER@my.ftpserver.de: will copy into the user's home directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.