Recursively apply "ignored files" pattern to subdirectories

Nextcloud Client version: 3.4.2
Operating system and version: Fedora 35

Hi,
I use many git repositories from different repos since I collaborate with different people. I want to avoid NextCloud messing with my git repos but I want to have the same repo hierarchy on all my clients (4 different computers running Linux).
I systematically put all my repos in folders ending with the suffix _GIT (e.g., MYSITE_GIT, PATTERNS_GIT …). What I want is to synchronize all the folders named as such, but to keep in them only the files that start by an underscore (in which I store the repo information that then I use to restore in the different clients). So I use the following patterns:

*_GIT/[!_]*
*_GIT/.*

This works but there is a problem: it works only in the root directory. That is it works for say

/MYSITE_GIT/ 

but not for

/WORK/MYSITE_GIT/

since in the latter case, all the files and subdirectories of MYSITE_GIT are synchronized

The temporary solution I found is to put the pattern

*_GIT/[!_]*
*_GIT/.*

into .sync-exclude.lst file that I copy systematically in all subdirectories. But of course this is no a nice solution. Isn’t there a way to specify that the pattern should be applied at any possible depth, for instance by using a double slash, that is:

//*_GIT/[!_]*
//*_GIT/.*

thank you in advance

I’m not sure ignored files is intended to work as you describe. In my understanding you can define a global file name mask to ignore (and some are hard-coded). This file mask is applied for every file in every folder… there is no way to say *ignore files .xyz only in specific folder. if it work on top level folder this most likely due to some issue with file names expansions and rather a bug than a feature…

Did you ever get a solution to this? I seem to be holding git repositories as well, specifically dotnet projects. I was wanting to exclude the obj folder, and unit test folders from being syncd.