52p2xa
28.59K
· August 2012 ·
Photo on 2012 07 30 at 18.13

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!

Sign in or sign up to add your response.

13 Responses

27
13a9550a854af911366d9f5deb785cd6

Nice! Exactly what I wanted :D

over 1 year ago ·
336

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 ·
1540
Photo on 2012 07 30 at 18.13

@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 ·
4812
246616 416406611741771 905925119 n

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 ·
5961
19772641f8c50f5b1c134b47131f0528

Or you could use git like everyone else

over 1 year ago ·
6347
Photo on 2012 07 30 at 18.13

@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 ·
6430
B575417444146c75f6f525dc8706e5d0

Cool tip. Thanks!

over 1 year ago ·
6431
Profile orchid bw

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

over 1 year ago ·
6438
02248dedbea3c46a4500673ea63da284

I think that use sshfs is simplest solution...

over 1 year ago ·
18118
None

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 ·
18211
None

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 ·
19335

I wrote and have used for over a year a tool called SyncR; it relies on SSH / SCP to perform file uploads. Check out the usage guide:

http://blog.eberstarkgroup.com/?p=1

over 1 year ago ·
23227
Dj1cpmcx normal

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

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

8 months ago ·
Featured Programming Job

Senior Software Engineer
·
San Francisco
·
Full Time
Search all programming jobs