Where developers come to connect, share, build and be inspired.

58

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

14601 views

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!

Comments

  • Blank-mugshot
    timpietrusky

    Nice! Exactly what I wanted :D

  • 0_lwfcfpajzwbcliuc1oajfrawnel-5ldcpfrjfrpwwa5gstvbjs0mwkebs5ad6g2rkedyhbmhdpb4
    fractal

    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?

  • Photo_on_2012-07-30_at_18.13
    sergiotapia

    @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!

  • 246616_416406611741771_905925119_n
    qweikeris

    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?

  • Blank-mugshot
    twneale

    Or you could use git like everyone else

  • Photo_on_2012-07-30_at_18.13
    sergiotapia

    @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.

  • Blank-mugshot
    akagr

    Cool tip. Thanks!

  • Profile_orchid_bw
    fierydebris

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

  • Blank-mugshot
    tomashanacek

    I think that use sshfs is simplest solution...

Add a comment