There are several possible ways that a site with a 'remote-host' of 'localhost' or '127.0.0.1' could be a connection to a drush remote host.

I'm specifically thinking of the case in which a Vagrant VM is running. Vagrant automatically forwards the SSH port so that you can `ssh localhost -p2222` (for example) and connect to your VM.

This might also be the case if you have an SSH tunnel set up.

It looks like the hostname is checked in several places throughout the codebase, and it would be nice to have some sort of flag (i.e. 'force-remote') in the alias configuration to run commands as remote, even if it is connecting to a port on localhost. I'll mull this over and see what I can come up with.

Comments

Steven Merrill’s picture

Status: Active » Postponed

The workaround below works, so maybe this isn't as big a deal as I had thought. (This is a pretty advanced use case.)

$aliases['tha-vagrant'] = array(
  'remote-host' => 'default',
  'remote-user' => 'vagrant',
  'ssh-options' => "-o'HostName 127.0.0.1'",
);
moshe weitzman’s picture

Status: Postponed » Closed (works as designed)

Yeah, known limitation. What I usually do is create a hosts entry for 'tha-vagrant' or similar that points to 127.0.0.1