Obsidian Sync: use gitignore-style configuration

Use case or problem

I am putting code in my vault - mostly python and Latex. Even though obsidian do not directly support these kinds of files I want to keep them together, so that I can link from markdown to specific python and latex files (and the other way around).

I want to sync the code as well as the .md files, but there is not enough options in the sync settings to be able to sync correctly. One either cannot sync code, or must also sync files which should not be synced.

Proposed solution

Add support for .gitignore files.

When a .gitignore file is found in some folder, any files further down in that folder will be ignored according to the rules in the .gitignore file.

Current workaround (optional)

Currently I simply sync all files, but that unfortunately includes a lot of build-files and other files which should not be synced.


Obsidian sync has an internal mechanism for excluding folders. .
You could make your scripts output in specific directories and exclude them.

Good solution for many such files, thank you!

Python folder: “cache” can be excluded, as well as “venv”

Some cases are not solved by this though:

  • many such folders would require a lot of manual work to add - would be nice to ignore all folders that include some name, for instance exclude cache or venv
  • latex (by default) generates files in the root folder where it is built, I will look into generating the files into a specific folder.

This would be very helpful, even better would be to support another file than .gitignore (like .dockerignore).

I currently have most of my notes mixed in with my code and I can’t practically point Obsidian at these notes because it’s 80% binary artifacts (like node_modules, build/, dest/, etc.) and 10% code that shouldn’t be indexed.

.gitignore support would allow excluding the first items, while .noteignore could be used to just index .md and other supported files.

I would also love to be able to use a gitignore file in a folder to decide what us being synced or not.