Last Updated: September 27, 2021
·
43.51K
· sergiotapia

Using Sublime Text 2 and SFTP to work on remote files.

Coming from a .NET MVC3 background, this concept of working with plain files was new to me. I was used to having to publish files, and copying the compiled binaries over to my host's folders.

Since I'm working with PHP exclusively in my new job, I had to find a good way for me to work and not waste time doing things over and over again.

Here's what I do when working with remote files.

  1. Install Sublime Text 2.
  2. Install Sublime Package Control.
  3. Install Sublime SFTP.

Great!

Once that's setup, you want to create a folder somewhere on your machine and open it using Sublime Text 2.

Right click the folder and select SFTP -> Map To Remote and a file will be generated for you.

This is the configuration files Sublime SFTP uses to read FTP credentials and host information.

Type in your credentials and select SFTP -> Sync Remote to Local. This will pull all files and data to your local folder.

Now when you modify a file, just right click it and SFTP -> Sync Local to Remote and it'll push changes automatically to your FTP folder.

Quick and painless and very easy!

If you want you can hotkey the process and make it even faster!

12 Responses
Add your response

Nice! Exactly what I wanted :D

over 1 year ago ·

Is it possible to use this in conjunction with Xdebug running on the remote server, and the SublimeXdebug package installed? Would I be able to step through the lines of my local file?

over 1 year ago ·

@fractal I've never tried that to be honest, if you do give it a shot, please let us know how it went - or better yet, write a pro-tip!

over 1 year ago ·

if I have a folder with many files and I only edit one file, then sync that folder with "Local ->remote" , it will upload all the files in that folder, not just the file I edited. Can this be changed?

over 1 year ago ·

Or you could use git like everyone else

over 1 year ago ·

@qweikeris Check you SFTP configuration file for an option that says Upload on Save and set that to true.

Now when you save a file it'll upload automatically.

over 1 year ago ·

Cool tip. Thanks!

over 1 year ago ·

@qweikeris Sublime SFTP also supports uploading / syncing single files through the right-click menu.

over 1 year ago ·

I think that use sshfs is simplest solution...

over 1 year ago ·

Hey! While syncing from remote to local, it gives me a permission denied error.

Sublime is on my windows and I'm trying to edit files residing on my RHEL

over 1 year ago ·

Hello!
"If you want you can hotkey the process and make it even faster!"
How can I do it?
Thank you :-)
EDIT: solved
http://stackoverflow.com/questions/22623086/sublime-text-2-setting-key-bindings-for-uploading-files-with-sftp

over 1 year ago ·

this video explain very well the topic, it´s an extra information for this article

https://www.youtube.com/watch?v=Krp2ksOP3qE

over 1 year ago ·