I'm trying to use Sublime Text 2 as an editor when I SSH in to my work server, and I'm stumped. I found this http://urbangiraffe.com/2011/08/13/remote-editing-with-sublime-text-2/ (among many other posts) that looks like it might help, but I don't follow it exactly, particularly with what values I should put in for the remote variable in line 5. I set "/Users/path/to/local/copy" to my local root directory, but I don't know if that's right or if there's more to do. Any thoughts? I'm on OSX10.8


当前回答

I am on MacOS, and the most convenient way for me is to using CyberDuck, which is free (also available for Windows). You can connect to your remote SSH file system and edit your file using your local editor. What CyberDuck does is download the file to a temporary place on your local OS and open it with your editor. Once you save the file, CyberDuck automatically upload it to your remote system. It seems transparent as if you are editing your remote file using your local editor. The developers of Cyberduck also make MountainDuck for mounting remote files systems.

其他回答

您可以使用rsub,它的灵感来自TextMate的rate。从描述来看:

Rsub是Sublime Text 2的TextMate 2的“rate”特性的实现,允许使用SSH端口转发/隧道在远程服务器上编辑文件。

这里有一个关于如何正确设置它的好教程:(断开链接)http://log.liminastudio.com/writing/tutorials/sublime-tunnel-of-love-how-to-edit-remote-files-with-sublime-text-via-an-ssh-tunnel

I am on MacOS, and the most convenient way for me is to using CyberDuck, which is free (also available for Windows). You can connect to your remote SSH file system and edit your file using your local editor. What CyberDuck does is download the file to a temporary place on your local OS and open it with your editor. Once you save the file, CyberDuck automatically upload it to your remote system. It seems transparent as if you are editing your remote file using your local editor. The developers of Cyberduck also make MountainDuck for mounting remote files systems.

我一直在做一个叫GitSync的项目。它仍然需要一些改进,但它是开源的,我已经每天都在使用它好几年了。我还在开发一个原生OS X版本,我称之为GitSyncApp

现在它只支持OS X,但是它应该很容易添加对Linux的支持,可能也支持Windows。

它通过监视文件系统事件来工作,并使用git来同步本地机器和服务器上的项目文件夹。

我尝试了其他解决方案,如osx保险丝,扩展驱动器,传输,几个解决方案,使用rsync等。它们在小型项目中都能正常工作,但如果你要处理大量代码,它们就不适合我了。

许多文件系统选项都进行缓存以提高性能,这很好,但事实并非如此。比如,如果你和其他人一起工作,而其他人更改了服务器上的文件。

如果我在一个脆弱或缓慢的网络上,我也会遇到问题,最终会得到空文件。或者文件没有同步,缓存就会变得奇怪;希望你最近做过。使用git解决了这个问题,因为它检查每个提交的完整性。

两个额外功能:

每次保存都要提交一次。它不是特别有用,但如果你需要回到过去,你可以。 它适用于任何文本编辑器。

一个对我来说非常有用的解决方案——在Mac上进行本地编辑,然后让文件自动同步到远程机器上

Make sure you have passwordless login to the remote machine. If not, follow these steps http://osxdaily.com/2012/05/25/how-to-set-up-a-password-less-ssh-login/ create a file in ~/Library/LaunchAgents/filesynchronizer.plist, with the following content: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>filesynchronizer</string> <key>ProgramArguments</key> <array> <string>/usr/bin/rsync</string> <string>-avz</string> <string>/Users/USERNAME/SyncDirectory</string> <string>USERNAME@REMOTEMACHINE:~</string> </array> <key>WatchPaths</key> <array> <string>/Users/USERNAME/SyncDirectory</string> </array> </dict> </plist> In a terminal window run launchctl load ~/Library/LaunchAgents/filesynchronizer.plist That's it. Any changes to any files in ~/SyncDirectory will be synchronized to ~/SyncDirectory on the remote machine. Local changes will override any remote changes.

这将创建一个监视SyncDirectory的launchd作业,当有任何更改时,将运行rsync将该目录同步到远程计算机。

另一个类似于osxfuse的mac解决方案是只使用Panic Software的传输FTP客户端,它允许您将远程文件夹挂载为本地磁盘。它支持SFTP,非常安全。