zoukankan      html  css  js  c++  java
  • 转载---VisualStudioCode通过SSH远程编辑文件

    最近需要长期修改远端服务器上的代码,调试。vim操作又不是很6,想到了远程操作的办法,找到一篇好用的bolg,记录一下。

    原文链接:https://blog.csdn.net/qq_38401919/article/details/80728516 

    在远程服务器上编写文件是一件很糟糕的事情,vim和其他终端编辑器,让速度和熟练度大打折扣,一整天使用vimFTP客户端并不是一件舒心的事情。

    所以,如果你已经知道SSH是什么以及涉及到什么,你可以完全访问你的服务器,你就无需害怕终端。

    现在我们通过使用Visual Studio代码通过SSH远程编辑文件

    步骤一:
    安装扩展 `remote-vscode`
    步骤二:

    添加 RemoteForward 52698 127.0.0.1:52698 到 ~/.ssh/config:

    Host myRemoteServerName
        HostName 12.34.567.89
        User root
        ForwardAgent yes
        RemoteForward 52698 127.0.0.1:52698
    步骤三:

    连接远程:

    ssh -v myRemoteServerName

    安装rmate:

    wget -O /usr/local/bin/rcode https://raw.github.com/aurora/rmate/master/rmate &&chmod a+x /usr/local/bin/rcode
    步骤四:

    重新登陆远程, 运行

    rcode some_file.php
    
    或者
    
    rmate some_file.php

    文件就会出现在Visual Studio

    PS:

    我在远程添加别名 .bashrc –> alias code='rcode' 这样我的本地和远程就可以用相同的命令从终端打开Visual Studio

    如果报错 “no such file or directory” , 你需要编辑PATH:

    echo "export PATH="$PATH:/usr/local/bin"" >> /etc/profile

    以上

  • 相关阅读:
    redis-cluster配置
    centeros7安装docker
    redis-sentinel主从复制高可用
    redis的主从同步
    redis安全(加入密码)
    redis的持久化相关操纵
    maria(mysql)的主从复制
    nginx+uwsgi+virtualenv+supervisor部署项目
    scrapy_redis之官网列子domz
    豆瓣模拟登录(双层html)
  • 原文地址:https://www.cnblogs.com/hellowooorld/p/9951534.html
Copyright © 2011-2022 走看看