Use drush-vagrant to create drush aliases

To create drush aliases for vagrant installations, you can use the drush-vagrant project.

I can't get the current version, 7.x-2.0-rc4, (https://drupal.org/node/2220291) to make an alias that I can use from my host into my vagrant, but the 7.x-1.0-alpha4 version works just fine after I patched it (https://www.drupal.org/node/2398349). Here's how to do it.

drush dl drush-vagrant-7.x-1.0-alpha4 
// This adds the drush-vagrant directory 
// to your ~/.drush directory

Save my patch to your ~/.drush/drush-vagrant directory. From ~/.drush/drush-vagrant run: 

git apply < 0001-checks-if-line-is-not-empty-before-adding-o.patch.txt 

cd ~/YOUR_VAGRANT_DIRECTORY

vagrant up
vagrant ssh-config 
// This command prints information that you will use 
// with the drush vagrant script.  

 

drush vagrant 
// Answer the questions. 
// You can include http://... in the URI question.

Copy the results into ~/.drush/aliases.drushrc.php and Voila! You can now drush from your host into your Vagrant using the alias like so: 

drush @my_alias status

Add new comment