使用 sftp 插件上传的 Visual Studio Code 忽略了 .git 文件夹和 .gitignore 文件

net*_*djw 3 sftp visual-studio-code

我有这个sftp.json文件:

{
    "name": "projectname",
    "remotePath": "/htdocs/",
    "host": "myhostdomain",
    "protocol": "ftp",
    "username": "user",
    "password": "pass",
    "passive": true,
    "watcher": {
        "files": "**/*",
        "autoUpload": true,
        "ignore": [
            ".vscode",
            ".git",
            ".gitignore",
            "config.php"
        ]
    }
}
Run Code Online (Sandbox Code Playgroud)

它确实忽略了.vscode文件夹和config.php文件,但不忽略.git.gitignore

我怎样才能解决这个问题?.git 文件夹的更改会产生大量的网络使用量。

小智 5

这个问题已经过去三年了,我不确定是否有人仍然需要这个答案。

由于我也陷入了同样的陷阱,所以在这里留下一个可能的解决方案希望对其他人有所帮助。:)

根据该项目在 github 上的 wiki 页面

开发者更新了设置字段名称,因此您的 sftp 设置需要更改为

{
    "name": "projectname",
    "remotePath": "/htdocs/",
    "host": "myhostdomain",
    "protocol": "ftp",
    "username": "user",
    "password": "pass",
    "passive": true,
    "watcher": {
        "files": "**/*",
        "autoUpload": true,
    },
    "remoteExplorer": {
        "filesExclude": [
            ".vscode",
            ".git",
            ".gitignore",
            "config.php"
        ]
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这个,它对我有用。