You can use
scp or SFTP to upload and download files to / from your sites. All methods use SSH behind the scenes.
Tip: upload via staging
Rsync is the most efficient upload method as it only transfers differences between your computer and a remote destination. We recommend it over
scp and SFTP.
On macOS and Linux,
rsync is most commonly pre-installed.
Working with rsync¶
Let's upload an
awesome-theme folder to site's
wp-content/themes. First, add this to your
Host mysite HostName ssh-staging.versionpress.com User ih6n2tu9 Port 30860
All the values come from the SSH tab in the portal.
You can now upload the
awesome-theme folder, referring to the remote destination just as "mysite":
rsync -azv awesome-theme mysite:/var/www/html/wp-content/themes/
If you want to skip the
~/.ssh/config step, the raw command would look like this:
rsync -azv \ -e 'ssh -p 30860' \ awesome-theme \ email@example.com:/var/www/html/wp-content/themes/
Careful about trailing slashes
Trailing slashes are generally significant for rsync. Uploading
/remote/path will create
awesome-theme/ would lead to
You can use
--dry-run (typically in a combination
-azvn) to preview the sync.
Another useful option is
--delete which removes files from remote that no longer exist locally, essentially mirroring the directory:
rsync -azv --delete awesome-theme mysite:/var/www/html/wp-content/themes
- Nice tutorial by DigitalOcean
- Usage examples
- Deploying code with rsync – also contains WordPress-specific examples
scp ("secure copy") is another way to upload files from command line – simpler but not as efficient as rsync.
You would upload a theme like this:
scp -r awesome-theme mysite:/var/www/html/wp-content/themes
Uploading via SFTP has several pros and cons:
- ➕ There are many SFTP clients available, for example WinSCP or Cyberduck.
- ➕ Most editors and IDEs support SFTP.
- ➕ You can mount SFTP as a local folder.
- ➖ SFTP is much slower and less reliable than rsync.
- ➖ You need to be careful which apps you use, for example, FileZilla sometimes bundles strange software.
Find connection info on the SFTP tab on your site:
If you have some SFTP app installed, you can even click the button in the portal and it should launch with the correct connection info.