vscode ftp-sync 插件使用

插件安装和配置

1、下载ftp-sync插件(extensions中直接搜索安装即可)
2、ctrl+shift+p 选择执行Ftp-sync: init
配置文件json含义如下

{
    "remotePath": "/usr/local/orange", //远程服务器代码路径
    "host": "111.111.111.111", //远程服务器IP地址
    "username": "root", //远程服务器登录名
    "password": "root", //远程服务器密码
    "port": 22, //ftp的默认端口是21,sftp默认端口是22
    "secure": false, 
    "protocol": "sftp", //端口是21写ftp,端口是22写sftp
    "uploadOnSave": true, //默认是false,建议设置成true,这样每次修改后ctrl+s保存后会自动同步
    "passive": false,
    "debug": true, //默认是false,如果设置为true,可以看到通过菜单的 查看->输出 打开输出界面
    "privateKeyPath": null,
    "passphrase": null,
    "agent": null,
    "allow": [],
    //ignore 忽略同步的目录和文件
    "ignore": [
        "\\.vscode",
        "\\.git",
        "\\.DS_Store"
    ],
    "generatedFiles": {
        "extensionsToInclude": [
            ""
        ],
        "path": ""
    }
}

插件的使用方法

从远程服务器下载代码到本地
1、本地创建放置的代码目录local_code
2、vscode打开local_code目录
3、ctrl+shift+p按照如下顺序选择:
Ftp-sync: Remote to Local --> . Choose this folder(选择当前目录) --> Full sync(删除本地孤立项)/Safe sync(不删除本地孤立项)/Force download(下载文件,无论更改否) --> Run(全部下载)/Review(选择下载)

本地修改后同步到服务器
有如下几种方法来同步:
1、如果"uploadOnSave"设置为true,每次保存文件的时候会自动同步(如果无效,请关闭vscode后重新再打开,就可以使用了)
2、在左侧文件列表中选择要同步的文件,右键选择:Ftp-sync: Upload File
3、ctrl+shift+p然后选择Ftp-sync:Sync Current file to Remote

发布了108 篇原创文章 · 获赞 8 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_33242956/article/details/103988441