Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code with sftp plugin upload ignored .git folder and .gitignore file

I have this sftp.json file:

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

It's really ignore the .vscode folder and config.php file, but not the .git and .gitignore

How can I fix this? The .git folder's changes generate massive network usage.

like image 908
netdjw Avatar asked Feb 19 '26 01:02

netdjw


2 Answers

The following configuration is valid for me:


{
    "name": "My Server",
    "uploadOnSave": true,
    "ignore": [
        ".git",
        ".gitignore"
    ]
}
like image 160
nettm Avatar answered Feb 21 '26 13:02

nettm


It's been three years since this question and I'm not sure if anyone still needs this answer.

Since I also fell into the same trap, leaving a possible solution here hoping it helps others. :)

According to the project's wiki page on github

The developer has updated setting field name, So your sftp settings need to be changed to

{
    "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"
        ]
    }
}

I have tried this, and it works for me.

like image 43
wenyu Avatar answered Feb 21 '26 12:02

wenyu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!