参考资料:
https://blog.csdn.net/u012560340/article/details/83030680
https://github.com/liximomo/vscode-sftp/issues/469
首先下载sftp插件
cmd+shift+p->输入SFTP:Config打开配置文件
同一项目下文件上传到多个sftp服务器:
{ "name" : "linux", "protocol": "sftp", "port": 36000, //服务端sftp端口 "context": "/local/project1", //本地映射文件夹路径 "remotePath": "/home/username/project1", //服务器映射路径 "uploadOnSave":true, "ignore": [ ".vscode", ".git", ".gitignore", ".DS_Store" ], "profiles": { "user1":{ "host": "100.100.100.100", "username": "username1", //服务器用户名 "password":"password1" //服务器密码 }, "user2":{ "host": "200.200.200.200", "username": "username2", //服务器用户名 "password":"password2" //服务器密码 } } }
不同项目下文件上传到同一个sftp服务器的不同文件夹:
[ { "name" : "linux", "protocol": "sftp", "port": 36000, "host": "100.100.100.100", "username": "username", //服务器用户名 "password":"password", //服务器密码 "context": "/local/project1", //本地映射文件夹路径 "remotePath": "/home/username/project1", //服务器映射路径 "uploadOnSave":true, "ignore": [ ".vscode", ".git", ".gitignore", ".DS_Store", "__pycache__", ".remote-sync.json", "*.zip", "*.pptx", "*.msg" ] }, { "name" : "linux", "protocol": "sftp", "port": 36000, "host": "100.100.100.100", "username": "username", "password":"password", "context": "/local/project2", "remotePath": "/home/username/project1", "uploadOnSave":true } ]
uploadOnSave为修改后保存自动上传,也可=false,然后修改之后,在项目中右键修改的文件/目录,upload指定的文件即可