Can I use --remote-host without a site-alias? I am trying to use Drush to execute some commands as part of my CI/CD workflow. The problem is that due to it's flexibility I want to avoid using site aliases which would basically mean writing temporary files during the build process (I really want to avoid that).

However, I've been trying to use --remote-host, --remote-user and --root in-line (e.g. 'drush --remote-host=example.com --remote-user=exampleuser --root=/var/www/example.com') without success. I did some debugging with XDebug and it seems that even though Drush initially picks up the provided command-line options it later purges them again/overrides them at some point. Is that a Drush Bug or am I doing something wrong / missing something?

Will do some further debugging now but maybe someone knows the answer ;).
Drush internally converts site aliases into command line options before doing a remote dispatch, so I would expect that you should be able to make --remote-host work without creating an alias.

Here is something that I tried.

$ drush @live sql-conf -v
Calling proc_open(ssh -o PasswordAuthentication=no user@server.org 'drush  --verbose --root=/srv/www/drupal/htdocs --uri=http://site.org  sql-conf 2&gt;&amp;1' 2&gt;&amp;1);

$ drush --remote-host=server.org --remote-user=user --root=/srv/www/drupal/htdocs --uri=http://site.org sql-conf


The first version, with an alias, worked, but the second invocation with cli options got confused, and tried to execute the command locally.  I got the same result in 6.x and 5.x, so I guess this has been broken for a long time.  I created a bug report on GitHub for this:

https://github.com/drush-ops/drush/issues/369

Fortunately, there is one more option.  Drush will let you craft an alias on the command line, by combining the different elements of the alias record in a special form, "user@server/path#site".  So, I did this:

$ drush user@server.org/srv/www/drupal/htdocs#site.org sql-conf -v


That worked.