Git negate syntax not working?

Hi. New kopia user here!

I’ve been trying to backup only some files on my ~/.config directory. For instance, I have the google-chrome folder there, and there a lot of files and directories inside of it. The only file I’m interested in, however, is google-chrome/Default/Preferences.

So this is the Ignore Rule policy I came up with:


However, the filter above doesn’t backup any files on my ~/.config dir whatsoever. Am I misunderstanding something here? Shouldn’t this work?

I’m using the AppImage of Kopia v0.9.0-rc2.


According to the document,

It is not possible to re-include a file if a parent directory of that file is excluded

Because * would exclude google-chrome/, anything inside will always be excluded.

Take a look at THIS THREAD. It took a lot of banging my head against the wall, but I was able to create a system that worked for me that does indeed create exceptions to your exclude rules. You can exclude all and then include specific files or folders, or even exclude a subfolder, but then include specific files or folders within that subfolder. There are gotchas so set up a little test environment and hammer away and you’ll figure it out.

You basically have 3 tools at your disposal, along with various combinations of those tools:

  1. Go real deep with include and exclude patterns and get really creative implementing them for your own needs
  2. Create a new snapshot for specific categories of data that follow similar rules and create a different rule set for each snapshot that will snag that specific subset of data.
  3. Use multiple .kopiaignore files. For example, you can have a global rule (.kopiaignore file that lives at the root of the snapshot source directory) that ignores all .exe files *.exe, but then in a specific subfolder you can create another .kopiaignore rule that includes them !*.exe and in that subfolder it will back up your .exe’s

How you go about it depends on your larger data and backup situation. For example, to grab “Preferences” you should be able to just add the following, but it would grab any instance of the word “Preferences”


An example of something I later created since posting to the thread linked above: (exclude folder, but still include specific contents)

#put the following at the end of your .kopiaignore file, after your other exclusions

#exclude all contents of "subfolder1" 

##include the following file types inside the previously-excluded, "subfolder1"

Hopefully that gives you enough to get started, but it will come down to trial and error. I love kopia, but filter rules are painful and .gitignore documentation is only partially accurate for kopia, as far as I can tell.

Oh, and everything is CASE SENSITIVE, which is painful for my situation and nearly doubles the lines of rules I have to create.

Here is an example:

You want to exclude all except folder “mytest”

Corresponding files policy should look like


Regarding the original question … This should work around the “kopia gitignore bug”