Skip to content

Instantly share code, notes, and snippets.

@jonathanbardo
Last active December 30, 2015 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanbardo/7782311 to your computer and use it in GitHub Desktop.
Save jonathanbardo/7782311 to your computer and use it in GitHub Desktop.
WP-CLI SSH
# Querying vagrant
$ cd ~/Sites/vvv/www/example.com/
$ vagrant ssh
$ cd /www/example.com/
$ wp plugin status
$ exit;
# Querying staging server
$ ssh root@awesome.staging.server
$ cd /www/example.com/
$ wp plugin status
$ exit;
ssh:
vagrant:
# The %pseudotty% placeholder gets replaced with -t or -T depending on whether you're piping output
# The %cmd% placeholder is replaced with the originally-invoked WP-CLI command
cmd: vagrant ssh-config > /tmp/vagrant_ssh_config && ssh -q %pseudotty% -F /tmp/vagrant_ssh_config default %cmd%
# Passed to WP-CLI on the remote server via --url
url: local-www.yourawesomewebsite.com
# We cd to this path on the remote server before running WP-CLI
path: /your/vvv/path/
staging:
cmd: ssh %pseudotty% util.example.com %cmd%
url: staging.example.com
path: /var/www/staging.example.com/current/docroot
# WP-CLI over SSH will stop if one of these are provided
disabled_commands:
- db drop
- db reset
- plugin install
- core multisite-convert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment