Sublime Text3插件sftp的安装

一、sftp扩展安装:

Ctrl+P,输入install,回车。待跳出窗口后输入SFTP,点击进行安装。

二、创建本地目录及内容

本地新建一文件夹(file),点击Sublime Text3菜单栏“Project”,弹出下拉菜单,点击“Add Folder to Project…”,选择“file”文件夹。然后在file菜单下新建hello.js文件,输入部分内容:

// hello.js
console.log('Hello, World!');

然后把文件同步到远程服务器上。

三、将文件同步至远程服务器

鼠标移至file工程目录上,右键弹出菜单,选择“SFTP/FTP”, “Map to Remote……”,可以看到file工程目录下生成了一个json文件:sftp-config.json。

修改sftp-config.json文件如下:

    "upload_on_save": true, // 文件一保存立即上传至远程服务器
    "host": "192.168.101.80", // 远程服务器上的地址,可以通过ifconfig或ip addr命令得到
    "user": "root", // 用户名,此处为root
    "password": "xxxx", // 用户名密码
    //"port": "22",
    "remote_path": "/home/file/", // 远程服务器上的目录(可连接远程服务器,新建file目录)


设置好sftp-config.json文件后,回到hello.js,按Ctrl+S保存,如下,显示文件上传至远程服务器成功。

四、登录远程服务器查看文件

# cd /home/file/
# ls
hello.js
# cat hello.js
# node hello.js

通过sftp扩展,直接将文件保存上传至服务器,可以大大提高开发效率

发布了135 篇原创文章 · 获赞 67 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/qq_25479327/article/details/81629967