Repository navigation
Description
Feature description
I would like Syncthing to support a user-controlled global ignore file that applies automatically to all folders without requiring any directive in .stignore. For example, a file like ~/.stglobalignore could be configured in Syncthing settings and its patterns would always be applied before evaluating folder-specific .stignore files. This follows the same approach as Git's global .gitignore.
This would eliminate cross-platform OS metadata pollution while maintaining Syncthing's design principles.
Problem or use case
Operating systems create platform-specific metadata files that serve no purpose on other platforms, yet Syncthing syncs them by default, creating unwanted clutter across devices.
- macOS → Windows/Linux:
.DS_Storefiles appear everywhere, serving no purpose on non-Mac systems - Windows → macOS/Linux:
Thumbs.dbanddesktop.inifiles clutter folders on systems that don't use them - Result: Every synced folder accumulates irrelevant OS metadata from other platforms
Current Situation:
Users must choose between:
- Accept platform pollution: Let OS metadata files sync and clutter all devices with useless files
- Manual maintenance: Add ignore patterns to every
.stignorefile across all folders
Git's Solution:
Git solved a similar problem with global .gitignore - allowing users to define patterns that shouldn't be committed to any repository. Syncthing users need the same capability for OS metadata files that shouldn't sync to any folder.
Alternatives or workarounds
Current workarounds are problematic:
Manual Duplication:
- Requires adding the same OS metadata patterns to every
.stignorefile - Requires remembering to add patterns to every new folder
- Creates inconsistent protection when patterns are forgotten
- Allows platform pollution in folders without proper
.stignorefiles
Relative #include Paths:
- Requires
#includewith relative paths like#include ../../../../.stglobalignorein every.stignore - Requires maintaining correct relative paths for each folder depth
- Creates complex path management across different folder structures
Default Patterns (Added in v1.19.0):
- Syncthing can configure default patterns that apply when creating new folders
- Only works as a template for new folders - doesn't update existing folders
- Doesn't help with folders already synced before setting up defaults
- No automatic updates when you want to add new global patterns
Script Automation:
- Custom scripts to generate
.stignorefiles automatically - Adds complexity and maintenance burden
- Not accessible to all users
OS-specific Default Patterns:
- Previously proposed built-in ignore lists for different operating systems
- Would automatically ignore common OS metadata files without user configuration
- Rejected due to complexity concerns and conflicts with "sync everything" philosophy
- The proposed global ignore file avoids those issues by being opt-in and customizable
A global ignore file would eliminate cross-platform metadata pollution with a simple, user-controlled solution that respects Syncthing's core design principles.
Activity
rasa commentedon Jul 5, 2025
While I appreciate the thoughtful and detailed writeup, this essentially is a duplicate of #7311, yes?
marbens-arch commentedon Jul 6, 2025
No.
marbens-arch commentedon Jul 6, 2025
Duplicate of #837
ZetabS commentedon Jul 6, 2025
@marbens-arch
While this relates to #837, that issue is ineffective as a duplicate. Issue #837 explored multiple approaches over 10+ years:
Rejected:
Discussed but never implemented:
#includedirective workarounds (I already mentioned in the issue)As shown above, #837 has become unfocused through scope drift - the original request was rejected in the second comment, but discussion continued mixing different implementation strategies across 80+ comments. Despite maintainer expressing openness to user-configurable global ignores, no concrete implementation plan emerged.
In contrast, this proposal introduces a Git-like approach not discussed in #837: a standalone user file that automatically applies to all folders without manual setup. Given #837's unfocused discussion and lack of actionable outcomes, a clear, targeted issue is needed to address the global ignore capability that remains unimplemented after years of discussion.
Should this concrete implementation proposal really be buried in #837's already dysfunctional 50+ comment thread instead of receiving focused consideration as a separate issue?
ZetabS commentedon Jul 6, 2025
Sorry if I was aggressive. I don't speak English as my first language.
I just wanted to know why you think the issue is duplicate.
ZetabS commentedon Jul 6, 2025
To clarify: this proposal is NOT about "adding global ignores by default".
This is focused on "applying global ignores by default if the user creates the file" - a key distinction from #837's
rejectednot convinced approach.imsodin commentedon Jul 6, 2025
To my understanding this is neither a duplicate of #837 nor #7311. @ZetabS already explained how it's different from #837. I'll give my reasoning why I agree with @marbens-arch on #7311 not being a duplicate as there's no reasoning there yet: #7311 is about shared and synced ignore patterns across devices for a single folder. This issue is about shared/common ignore patterns between all folders locally (single device/no syncing). That's both independent and also seems like a much simpler change. Also one that's in line with what's currently possible - as OP wrote, it's doable with relative out-of-folder includes, but that's brittle and is usually consider an anti-feature when it comes up (I might be using it for exactly this purpose of shared ignores :) ).
And while all of those issues might technically be duplicates of #2491, that would in my opinion not be a helpful stance - that's a ticket about an entirely new design. Shutting down incremental improvements on the existing design seems uncalled-for, as there's no active work on the new design, at least unless the proposed changes make it significantlyharder to move to a new design eventually - none of these tickets does that imo.
I think the backend change here is quite simple. It's a bit harder to represent it in the web UI in a way that's understandable. Both because good UX is hard anyway, even harder in our UI, and also because ignore patterns with includes aren't that simple to begin with. I think it would be necessary for a user to see the common patterns when editing folder patterns, but not be able to edit them there - otherwise it's too easy to accidentally make changes to common ignores that weren't intended. Maybe also easier to make this a non-UI only feature, to hide foot-guns :P
[-]Support a Global Ignore File Similar to Git[/-][+]Support common ignore patterns among folders locally[/+]calmh commentedon Jul 6, 2025
IMHO, if this were added, it should be in the config and not in a file, and includes should not be supported. I think this simplifies things.
ZetabS commentedon Jul 7, 2025
@calmh I agree storing patterns in the config would be simpler, but the user experience benefits are important to consider too.
Users already understand file-based ignore patterns from Git and existing .stignore files.
A global ignore file would be familiar, editable with any text editor, and shareable through dotfiles.
What are your thoughts on the user experience aspects?
rasa commentedon Jul 7, 2025
It would be easy enough to do both, with the file processed second, if it exists?
calmh commentedon Jul 8, 2025
Developers may be familiar with git, but they are a tiny subset of Syncthing users. I'm quite sure most users interact with the ignore patterns via the Syncthing GUI. As such it doesn't really matter where we store them, but I do think global ignore patterns would conceptually be part of the "configuration" and if I copied ~/.config/syncthing or wherever the config is stored to another machine I'd be surprised and annoyed if this specific little part of the config didn't carry over.
On that note, we also have the XDG militia who will be coming with the pitchforks if we put a file in ~ :D
ZetabS commentedon Jul 8, 2025
I didn't think about that. You're right. It should be in the config.
acolomb commentedon Jul 8, 2025
A possible compromise would be storing it in a separate file within
$XDG_CONFIG_HOME/syncthing/, next to theconfig.xml. This way we could retain the general file format, with the theoretical possibility to edit directly instead of going through the config API. Code-wise I suspect it might be more complicated than storing inconfig.xml, though.What I found more important is how do these patterns interact with the per-folder ignores? Is the global file always prepended to the folder-local one? Otherwise we can hardly combine this feature with a local catch-all
*pattern, preceeded by explicit negated patterns. Maybe the catch-all wildcard should even be forbidden in the global ignores, to make sure the local one will still be considered at all?ZetabS commentedon Jul 8, 2025
How about using both prepend and append patterns?
Global ignore:
Local ignore:
Evaluated ignore:
acolomb commentedon Jul 9, 2025
To fulfil that requirement, a proper config entry would be even more suitable IMHO. This could be easily split into "globalIgnorePrepend" and "globalIgnoreAppend" options. Putting a comment in the global file to mark where the local ones should be included makes for a pretty special case in the parser code, not a clean solution at all.
calmh commentedon Jul 9, 2025
For the stated use case, it sounds to me like the global ignore patterns should be considered appended to any local patterns, and negated patterns should not be allowed.
acolomb commentedon Jul 9, 2025
Hm... I don't have a use case in mind for global negated patterns. Something like this, with the local rules for a "selective sync" scenario, in fact does not conflict with the appended global patterns. The global ones are simply irrelevant:
Anyone else have an idea how negated global patterns may be practically useful?
rasa commentedon Jul 9, 2025
Perhaps the user doesn't want any folder specific ignores, but simply wants
for all their folders, so they put it in their global settings? Kinda how Synctrain works now, but for all folders.
Of course, this assumes that the global settings are evaluated first. If they use
*in their global settings, then their.stignorefiles become irrelevant. This may confuse the user, if we don't mention the global*is controlling.feat(ignore): auto-load .stglobalignore as shared folder ignore patterns
feat(ignore): auto-load .stglobalignore as shared folder ignore patterns