How to disable auto generating .gitignore when using vscode?

Hi all,
I’m new to platfromio. Currently I’m porting my previous projects on ESP8266 from makefile environment to platformio.
Since they are hobby projects, I put everything (including sw and pcbdesign) in one git repo. Therefore I use subfolders like software and pcbdesign to split them.

I have a folder structure like this:
Project
–software
----sw things including platformio.ini
–pcbdesign
----pcbdesign things
–.git
.gitignore

Since I open software folder with vscode directly, platformio will generate a .gitignore every time when I modifying the ini file. I have to manually delete it every time, which is very annoying.

Is there a way to disable this feature in configuration? So that platformio will not automatically generate the gitignore in subfolders.

Thanks in advance.

By modifying the platformio.ini in VSCode you are triggering the re-initialization of the project (pio init --ide=vscode). This will make the PIO core generate the .gitgignore by using the template file as seen here

https://github.com/platformio/platformio-core/blob/develop/platformio/project/tpls/vscode/.gitignore.tpl

As one can see in the Python code

The core iterates through every *.tpl file in its IDE folder and generates them; There’s no feature to ignore on template file.

Now one may think that one can just the .gitignore.tpl file on the harddrive where the PlatformIO scripts live, but that doesn’t seem to be the case: I’ve installed platformio via pip3 and this file is nowhere to be found – seems to be baked into just the pio.exe that gets installed.

So in all, if you want to have a feature for ignoring templates (in certain sitatuations), file a feature request at https://github.com/platformio/platformio-core/issues.

Otherwise: Why manually delete them? If the .gitignore is in a subfolder, isn’t it ignored anyway by git? And after all, the .gitignore settings there are sane, it ignores the build output and VSCode project files.

I have the same problem.
My platformIO project is a subfolder of a larger project, same as [tliu93].(https://community.platformio.org/u/tliu93). I prefer to use a single .gitignore in overall project’s root folder.

[maxgerhardt]

… If the .gitignore is in a subfolder, isn’t it ignored anyway by git?..

No. Git shows it as an untracked file.

Please file an issue →

Willdo. Thanks for replying: I was hoping it had been resolved by now.

New Issue:

1 Like

Thanks! See temporary solution in this comment