I'd like to use drush
to sync files from local server to production server. I have edited the aliases.drushrc.php
file and placed inside /drush/aliases
in both local and remote machines. Everything seems to work fine except that drush understands that both sites are in the same server since I do not know how to tell drush that local is in another machine in my local server.
I guess it's something to do with uri but I do not know what should I write there.
I've tried with this:
$aliases['local'] = array(
'uri' => 'mysite.localhost',
'root' => '/home/user/www/mysite',
);
and this:
$aliases['local'] = array(
'uri' => 'localhost/mysite',
'root' => '/home/user/www/mysite',
);
being mysite
the name of the folder placed in /home/user/www
in my local server, but none of them seem to work.
Anyone can tell me what am I doing wrong?
EDIT:
I have placed mysite.aliases.drushrc.php
in my local sites folder.
However I didn't succeed with the following code in my local site:
drush rsync @mysite.live:%files @mysite.local:%files
This is what I get:
You will destroy data from @mysite.local:/home/user/www/mysite/%files and replace with data from @carloscamara.live:/home/user/www/mysite/%files
Do you really want to continue? (y/n): y
The source and destination cannot both be remote.
rsync error: syntax or usage error (code 1) at main.c(1166) [Receiver=3.0.8]
This is mysite.aliases.drushrc.php
content:
$aliases['local'] = array(
'uri' => 'localhost/mysite',
'root' => '/home/user/www/mysite',
'path-aliases' => array(
'%files' => 'sites/default/files',
),
'command-specific' => array (
'sql-sync' => array (
'no-cache' => TRUE,
),
$aliases['live'] = array(
'uri' => 'mysite.com',
'root' => '/home/user/mysite';
'remote-machine' => 'mysite.com';
'remote-user' => 'myusername',
'remote-host' => 'mysite.com',
'path-aliases' => array(
'%files' => '/home/myusername/mysite.com/sites/default/files',
),
);
drush sa @mysite
to test; it should print out the records for @mysite.local and @mysite.live. Once this is working, trydrush -s rsync @mysite.live @mysite.local
, and if that prints reasonable stuff, then trydrush -s rsync @mysite.live:%files @mysite.local:%files
. Also, try pulling down today's master of drush withgit clone --branch master http://git.drupal.org/project/drush.git
, as I recently committed bug fixes for %files and rsync. – greg_1_anderson Feb 18 '12 at 20:44