Files syncing with Drupal

Published

Reviewed

Drupal keeps uploads in web/sites/default/files. That folder is not in Git and deployments leave it alone, so sync it on its own with the frbit CLI.

Install and deploy run down

  1. Install Drupal locally
  2. Deploy Drupal to fortrabbit
  3. Database syncing
  4. Files syncing ← you are here

Files down

Run it from the project root:

frbit files pull web/sites/default/files -e {{app-env-id}}
shell

Changed files are overwritten locally. Add --dry-run to see what would change, --delete to also remove local files that are gone on the environment.

Files up

frbit files push web/sites/default/files -e {{app-env-id}}
shell

It asks to type the environment ID first. The software template excludes web/sites/default/files from deployments, so pushed files survive the next deployment.

Without the frbit CLI

Both commands wrap rsync over SSH. The same with plain rsync:

# Down
rsync -av {{app-env-id}}@ssh.{{region}}.frbit.app:web/sites/default/files/ ./web/sites/default/files/

# Up
rsync -av ./web/sites/default/files/ {{app-env-id}}@ssh.{{region}}.frbit.app:web/sites/default/files/
shell

Written by AI, lectured by a human.

AI use & editorial processEdit on GitHub ↗