Use Gitlab Pipeline to push data to ftpserver

Then add the following code in your .gitlab-ci.yml file.

variables:
  HOST: "example.com"
  USERNAME: "yourUserNameHere"
  PASSWORD: "yourPasswordHere"

deploy:
  script:
    - apt-get update -qq && apt-get install -y -qq lftp
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev ./ ./public_html --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
  only:
    - master

The above code will push all your recently modified files in your Gitlab repository into public_html folder in your FTP Server root.

Just update the variables HOST, USERNAME and PASSWORD with your FTP Credentials and commit this file to your Gitlab Repository, you are good to go.

Now whenever you make changes in your master branch, Gitlab will automatically push your changes to your remote FTP server.


Got it :)

  image: mwienk/docker-git-ftp


    deploy_all:
      stage: deploy
      script:
        - git config git-ftp.url "ftp://xx.nl:21/web/new.xxx.nl/public_html"
        - git config git-ftp.password "xxx"
        - git config git-ftp.user "xxxx"
        - git ftp init
        #- git ftp push  -m "Add new content"

      only:
        - master