Information for: DEVELOPERS   PARTNERS

rsync and Drush with Windows

Drush is one of the most useful tools a Drupal developer or site builder can have in their arsenal. On Unix-based systems, it is reasonably straightforward to set up and get started using. Windows users have a more involved setup.


If you are using a Unix-based system for development, see rsyncing files on Acquia Cloud for Unix-specific directions.

Acquia Dev Desktop

Acquia Dev Desktop comes with Drush, rsync, and Composer pre-installed. Using it is one of the fastest ways to set up a working installation on Windows. When using Acquia Dev Desktop, you’ll need a separate client for version control (VCS). We recommend Git Bash, which includes an SSH client.

When your version control client is set up, you can directly clone your Acquia Cloud website. For information about cloning your website, see Starting with an Acquia Cloud site. After cloning your website, you should configure your Drush aliases, and test your setup using the Windows command line or your version control client.

Configuring Drush aliases

Drush aliases make it easier to direct where and what websites Drush needs to work with.

  1. Sign in to your Acquia account.

  2. Download your Drush aliases, and follow the instructions on that page to extract the file into the proper directory on your local machine. If the directory does not exist, you may need to create it.

    When the Drush aliases are saved properly, the path to the aliases file should look like this, where username is your Windows username:

  3. Edit the aliases file and add this array entry at the top, changing any details to match your local Drupal website setup:

    // Site sitename, environment local
    $aliases['local'] = array( 'site' => 'sitename', 'env' => 'loc', 'uri' => 'localhost:8082:', 'root' => 'c:/Users/username/Sites/mysite', );
  4. Save the file.

  5. Verify your site aliases are functioning properly using the following command to return a list of available aliases:

    drush sa --full

rsync files using Drush aliases

Acquia Dev Desktop will rsync files for your Acquia Cloud websites, and these commands can be customized to suit your needs.

Manual rsync of all files

If you need to sync your website’s files manually, use the following command, adapting it where necessary, to rsync your entire development environment to your local computer:

drush -vd --mode=ruLtvz rsync @mysite.local

The -vd option displays verbose debugging for troubleshooting. After you have confirmed the command works as you expect, you can remove the -vd flag.

Manual rsync of selected directories

By default, the drush rsync command rsyncs both your website’s code and files. If you want to transfer only the files directory, add the following lines to your Drush aliases file, adjusting it to match your actual alias and system file paths:

// Site mysite, environment local
 $aliases['local'] = array( 'site' => 'mysite', 'env' => 'loc', 'uri' => 'localhost:8082:', 'root' => 'c:/Users/[username]/Sites/mysite', 'path-aliases' => array( '%files' => 'sites/default/files', ) );

With this alias, you can run your working Drush command with the files path alias added, as in this example:.

drush -vd rsync @mysite.local:%files

For more examples, see Drush Tip: Quickly Sync Files Between Your Environments With Rsync.