Roots Discourse

WP-CLI --SSH on Windows


Has anybody successfully used the SSH command in WP-CLI on Windows?

When I try to use it like so:
wp --ssh vagrant@website.test

I get this error:
Error: Cannot connect over SSH using provided configuration.

The reason I am trying to use this command is so that I can utilise Ben Word’s Sync Script Plugin:

I have the same error when executing the command through Window’s command prompts and through WSL.



Are you using Trellis, too? I just got a Windows machine up and my steps for getting things working were a little weird:

Make sure your ~/.ssh/config file has the following in it or similar:

Host example.test
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /path/to/sites/
  IdentitiesOnly yes
  LogLevel FATAL
  ForwardAgent yes

Note the path to private_key — do something like this to copy it to your homedir on WSL:

cp /path/to/sites/ ~/example_vagrant_key
chmod 600 ~/example_vagrant_key

Then update ~/.ssh/config with the new path to the key:

-  IdentityFile /path/to/sites/
+  IdentityFile ~/example_vagrant_key
1 Like


I am indeed using Trellis. and your solution works perfectly. Thank you very much.

1 Like