vscode sftp 本地目錄設置問題


環境:win7 64位 vscode:1.46.1
問題描述:
  使用vscode打開文件夾方式打開項目后,本地文件E:\www\mypro\a.txt 可以上傳到遠程服務器 /Dockerfile/remotepro/a.txt,
  但是將此文件夾添加為工作區后,再保存文件自動上傳,文件E:\www\mypro\a.txt 卻上傳到遠程服務器的
  /Dockerfile/remotepro/mypro/a.txt。多了一層目錄mypro
 
下面可能是我們的一個sftp.json配置內容:
{
    "name": "My Server",
    "host": "47.8.8.34",
    "protocol": "sftp",
    "port": 22,
    "username": "afei",
    "password": "password",
    "remotePath": "/Dockerfile/remotepro/",
    "uploadOnSave": true
}
 
解決:
這時我們需要設置下context配置為當前目錄 mypro 或者 ../mypro 或者 www/mypro 均可以同步成功。
 
{
    "name": "My Server",
    "host": "47.8.8.34",
    "protocol": "sftp",
    "port": 22,
    "username": "afei",
    "password": "password",
    "remotePath": "/Dockerfile/remotepro/",
    "uploadOnSave": true,
    "context":"mypro"
}

 其他配置參見官網:https://github.com/liximomo/vscode-sftp/wiki/config

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM