In many cases, local development via
git push is not the preferred option. Local stacks can be a pain to configure. Developers and themers often want to immediately show work to a remote collaborator (or client), or need to debug a specific problem that only occurs with the Pantheon platform.
In these cases, making and pushing changes with git is an unsatisfying workflow. This is why we now offer SFTP mode.
Note: if you want to use Drupal's built-in update manager or the
apps.module, enable SFTP first!
You can enable SFTP for an environment from your site's dashboard. Click on the SFTP button at the top of the Code workspace to get started.
As SFTP is being enabled you will see the progress as the state change in the connection mode goes from git only to SFTP only.
This should be a fairly fast operation and the Code workspace will change to show the SFTP tools.
Once this is complete you will notice a comment box above the commit log. As you make changes to the codebase you will see all the pending changes appear.
When you are ready to commit the changes you make by SFTP you can enter the commit message here. This is the comment that will appear in the commit log after you save your changes.
SFTP connection information
To get your SFTP login credentials you can click on the help icon next to the SFTP command. This will start a load the SFTP connection information bubble where you can get your credentials.
Note: When you setup your SFTP client remember that SFTP will be the protocol and you will need to connect to your environment using a non-standard port 2222.
It is also possible to connect to an environment via SFTP by using the terminal. The command is easily accessible from the Connection information widget for the environment you are on.
Note: While SFTP mode is enabled, remote git pushes to Pantheon's dev environment will be blocked. You can still deploy committed code to test and live, but to prevent conflicts we cannot let you push code remotely while it is also being edited directory.
Once you have made changes to the code you will see a push notification on your "Dev" environment's dashboard. You will be able to view the file changes as well as a diff of the changes made.
Connecting Via SFTP
The connection information is a bit different than what you might be used to though as it based on your unique "Site ID". This is the long random-seeming string at the end of your dashboard URL and in your git connection string, something like:
Your connection data is as follows:
When SFTP is on, this information is available at the top of your "codebase" panel in the "dev" environment. There is a copy/paste to use a command-line sftp program, as well as a "?" popup that will show you your info for use in a GUI client.
For instance, in MacOS Cyberduck:
Once you have these settings in place, you can connect to your dev instance and edit files directly. You are also able use Drupal's built-in module update/install systems!
The list of directories you'll see will include a lot of Pantheon environment data and configuration. You're free to take a look there, but the Drupal site is in the "code" directory:
There are two ways to get access to your Pantheon site via SFTP. One method is by using you Pantheon account's dashboard password.
Alternatively you can connect via SFTP using the public SSH key you uploaded to your account. This will allow for password-less authentication. If you would like to generate a SSH key you can get more information on the wiki.
Committing SFTP Changes
Note: Even though you are unable to use git to push remotely with SFTP mode enabled, you still need to commit your changes to push them to test/live.
If you do not commit your code, you WILL LOSE ALL YOUR CHANGES! Commit and commit often, as it only takes a couple of seconds to do.
After you have made a change to your code you will notice that a message appears bellow the comment box letting you know you have some changes that are not in your repository.
Clicking on the yellow notification message will then expand the listing of pending changes you have made.
By clicking on the entry of recently updated files, you can view the changes that have been made to a particular file since the last commit. Once you are satisfied with you can close the modal and proceed to commit your changes to git using the UI
Just as with a normal git client, you should provide a helpful commit message to go with your change-set. This will make deploying your code a saner process, and make it easier for any other developers who pull your changes down to understand what you've done.
Once your message is ready, clicking on commit will trigger the commit job and a push notification will block the UI as the code is being committed.
Note:The blocking UI will appear for all users on the team who are looking at that environment. This is to maintain the integrity of the changes and so each team member is aware of the current state of the code.
Note: You will receive push notifications on your dashboard while in SFTP mode for all changes made within your Drupal codebase. These notification will be for everything except the "sites/default/files/" directory.