Can I use exclude-if-present to ignore any directory that's a git repository?

I’m looking for a way to make restic ignore git repositories. I found the option exclude-if-present. Does that also work with a directory, so that I could add the value “.git” to that option and it would ignore any directory containing a .git directory?

If not, could I specifiy a file in a subdirectory like .git/config for exclude-if-present to ignore the directory where .git is present?

If not, any other way to achieve that?

Try with —-exclude=**.git

Will that exclude just the .git directory or also the directory where .git is in?

Oh I do apologise - I misunderstood what you were asking.
No, what I’ve provided above won’t do what you’re after - again my apologies.

A workaround is to use the exclude-if-present option for files that are usually present in the root of a git repository like .gitignore, .gitattributes or .gitmodules.