Last updated January 26, 2012. Created by juampy on January 26, 2012.
Log in to edit this page.
In Windows, after installing Drush through the installer, some extra configuration is needed in order to execute commands in remote systems or synchronize data.
First of all, unless you are sure that when you installed Drush you marked the components "cwRsync" and "Register Environment Variables", launch the Drush installer again, click on Change and install them. This will set up your PATH variable with the location of every program that Drush needs and install cwRsync in order to use the Drush command core-rsync.
That being done, you will have to create your home path where cwRsync has been installed. this directory will be used to store your SSH key. Follow these steps to generate your SSH key and copy it to the remote host:
- Open the command line interpreter by going to Start > Execute > type cmd and hit Enter.
- Go to the cwRsync installation directory:
cd C:\Program Files\Propeople\Drush\cwRsync - Create your home directory at this level. It should be "home/your Windows username". If you type your username wrong, you will get an error later on when we execute a command for a remote Drupal site which will let you know how should the folder under home be called.
mkdir home
cd home
mkdir (your Windows Username)
- Generate your public key:
ssh-keygen
Hit Enter three times to accept each prompt. - Now login to the remote host where you want to gain password less access via SSH (for example, using Putty).
- Copy the contents of C:\Program Files\Propeople\Drush\cwRsync\home\your username\.ssh\id_rsa.pub into the home path of the remote user at .ssh/authorized_hosts. This could be done easier if you copy the id_rsa.pub file from a Linux system using the command ssh-copy-id -i id_rsa.pub user@host.
- Set up a remote alias at your .drush folder. You can find examples of this at Drush.org and the alias example.
- Test a command. If your remote site alias has been defined as @foo.dev, then try executing the following command:
drush @foo.dev status
If you get Drush and Drupal site information, then you are ready to start executing Drush commands over that site without the need of login in there first.
Comments
I can't seem to get this
I can't seem to get this right. I have Drush and the aliases configured. I'm stuck at step number 5 and 6. I used
drush @SITENAME.dev statusand it tried to connect but at the end I got an errorPermission denied (publickey).I have shell access on my shared host and access it using putty. Now, the commandssh-copy-id -i id_rsa.pub user@hostgives an error which statesssh-copy-id: command not foundIn order to go around this problem I just added the file through ftp to my .ssh folder inside my home directory /home/SITENAME/.ssh/authorized_hosts. After trying this I got the permission denied.
I also tried to upload the public key in cpanel's ssh program but it said it wasn't in a valid KEY format or something like that.
What am I doing wrong? Is there anything I can do to fix this?
Try first to log in, then test the commands
You should first make sure that you can log in without typing a password and then try with drush sql-sync or drush rsync. ssh-copy-id only works on Linux systems.
See if this link with further instructions does help.