Deploying Committed Changes to a Remote Server
Recently, we received the following question through Twitter: “What is the easiest way to deploy the changes of your last commit(s) to a remote project?”
Let’s explore our options!
Configuring a Remote Host
Working with a Remote Host is a broad topic of its own. To add a remote host, select Tools | Deployment | Configuration and provide the necessary details to connect to the remote host. This can be an FTP, FTPS or SFTP server as well as a local or remote folder. In this blog post we’ll use a remote server as a host which is accessed through FTP.
On the Mappings tab, we can also specify how the local and remote folder structure compare to each other. For example, we can map the local project root to a different content folder on the server.
Once finished, Tools | Deployment | Browse Remote Host will reveal the remote file browser. We can Drag & Drop files between the current project and the server and make use of synchronization.
Uploading files on commit
Let’s return to the initial question: how to deploy to this server when committing files to a VCS? Once a VCS system, whether Git, Mercurial, Subversion or another is registered for our project, we can make a change to our code and press Ctrl+K (Cmd+K on Mac OS X) to commit changes.
The Commit Changes dialog provides us with the option to upload files to a remote server after a successful commit. There is also a checkbox available which will automatically perform the upload after every commit.
The automatic upload process for a commit only transfers the current changeset’s files to the remote host. All preceding commits will be ignored by this process.
For a single developer, this workflow is ideal. After doing an initial synchronization between the current project and the remote server, every commit will be sent to the remote host (as long as it’s committed through PhpStorm).
In a team, not every developer is always working on the latest version of the VCS repository. If every developer uploads only their last commit to the remote host, chances are some files deployed will not be the latest ones and several commits will never make it to the server.
It is important for teams to do the deployment using a standardized flow, preferably automated. This can be done using a Continuous Integration (CI) server, TeamCity for example, which fetches the latest commit, runs PHPUnit and deploys it to the target machine.
Develop with pleasure!
– JetBrains PhpStorm Team
Subscribe to Blog updates
Thanks, we've got you!
Qodana Clone Finder: Early Access Program
In December 2020, we announced the EAP for Qodana, which is rapidly evolving into a comprehensive platform that allows companies to perform multi-level evaluations of the quality of code they own, contract, or purchase. Qodana helps you detect bugs without relying on an IDE, either on a local machi…
PhpStorm 2020.2 EAP #3
The Early Access Program for PhpStorm 2020.2 is in full swing and today we’ve got the third build of the 2020.2 EAP for you. In this blog post, you can read about improvements for Git installed in WSL2 and Search Everywhere. Download PhpStorm 2020.2 EAP (more…)…
PhpStorm 2019.3.3 Preview
We’ve just rolled out a preview for the third minor update for PhpStorm 2019.3. Please give the PhpStorm 2019.3.3 Preview build 193.6494.5 a try and share your feedback with us. (more…)…
How to Upgrade to PHP 7.4 with PhpStorm
Check out our fresh video with a few nice tips and tricks on how to update your codebase to PHP 7.4. It combines materials from the PhpStorm 2019.2 and PhpStorm 2019.3 releases, with a few cool bonuses to boot. Nikita drew our attention to the fact that setters are slower than assigning prop…