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
当前回答
我知道这很老了,但我有一个很酷的方法值得分享。
Conemu和WinSCP工具需要准备的内容。这些都是简单的指令
Open WinSCP.exe and login to my desired remote server (I have found that it's important to login before attaching ... ). In the preferences for WinSCP - two settings to change. Choose Explorer type interface and rather than Commander - so you don't see local files. Unless you want to (but that seems like it would suck here). Set up Sublime as your default editor. With ConEmu open, right click the tab bar and select the option Attach to.... A dialog box will open with your running applications. Choose, WinSCP and select OK. ConEmu will now have an open tab with WinSCP displaying your remote files. Right click on the WinSCP tab and choose New console.... When the dialog box opens, enter the path to the Sublime executable on your system. Before you press Start, In the box that says New console split select the radio button to right and set the percentage. I usually choose 75%, but you can customize this to your liking, and it can be changed later. Now you will see Sublime in the same window running to the right of WinSCP. In Sublime, from the View menu, choose Sidebar->Hide Sidebar, and bam, you now have remote files in exactly the same manner as you would locally - with a few caveats of course that comes with editing anything remotely. WinSCP is lightening fast though.
我有两个显示器-左边显示器显示Chrome浏览器,右边显示器显示代码编辑器。同样在ConEmu中,我创建了另一个选项卡并ssh到我正在工作的站点,所以我可以远程运行gulp或grunt,也可以从命令行操作文件。认真加快发展。
这是一张截图:
其他回答
另一个类似于osxfuse的mac解决方案是只使用Panic Software的传输FTP客户端,它允许您将远程文件夹挂载为本地磁盘。它支持SFTP,非常安全。
作为@ubik回答的后续,以下是让“subl”命令在远程服务器上工作的三个简单(一次性)步骤:
使用Sublime包管理器在Sublime Text中安装rsub包 [Local]执行以下Bash命令(这将建立一个SSH隧道,这是rsub的秘密武器): printf "Host *\n RemoteForward 52698 127.0.0.1:52698" >> ~/.ssh/config 在远程服务器上执行以下Bash命令(这将安装subl shell命令): sudo wget -O /usr/local/bin/subl https://raw.github.com/aurora/rmate/master/rmate Sudo chmod +x /usr/local/bin/subl
瞧!你现在在SSH上使用Sublime Text。
你可以从服务器上用subl ~/test.txt打开Sublime Text中的示例文件
我一直在做一个叫GitSync的项目。它仍然需要一些改进,但它是开源的,我已经每天都在使用它好几年了。我还在开发一个原生OS X版本,我称之为GitSyncApp
现在它只支持OS X,但是它应该很容易添加对Linux的支持,可能也支持Windows。
它通过监视文件系统事件来工作,并使用git来同步本地机器和服务器上的项目文件夹。
我尝试了其他解决方案,如osx保险丝,扩展驱动器,传输,几个解决方案,使用rsync等。它们在小型项目中都能正常工作,但如果你要处理大量代码,它们就不适合我了。
许多文件系统选项都进行缓存以提高性能,这很好,但事实并非如此。比如,如果你和其他人一起工作,而其他人更改了服务器上的文件。
如果我在一个脆弱或缓慢的网络上,我也会遇到问题,最终会得到空文件。或者文件没有同步,缓存就会变得奇怪;希望你最近做过。使用git解决了这个问题,因为它检查每个提交的完整性。
两个额外功能:
每次保存都要提交一次。它不是特别有用,但如果你需要回到过去,你可以。 它适用于任何文本编辑器。
您可以使用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.
推荐文章
- Github权限被拒绝:ssh添加代理没有身份
- 如何修复/转换崇高文本的空间缩进?
- 警告:未受保护的私钥文件!当尝试SSH到Amazon EC2实例时
- 如何设置ssh超时时间?
- 如何在SSH上使用Sublime
- 使用Git GUI或SSH -keygen的SSH私钥权限太开放
- 在gitlab上被拒绝许可(公钥)
- 使用脚本自动输入SSH密码
- 在Linux中是否有办法继续中断的scp(安全拷贝)命令进程?
- 为什么SSH远程命令得到的环境变量比手动运行时少?
- 将Keypair添加到现有的EC2实例中
- 如何解决“sign_and_send_pubkey:签名失败:代理拒绝操作”?
- 对于未设置密码的OpenSSH私钥,如何添加密码?
- 'heroku'似乎不是一个git存储库
- 如何使标尺始终显示在崇高的文本2?