Skip to content

Could we have a .stsharedignore file that gets synchronized between all the devices? #7311

Description

@jdevora

I want to ignore a set of files on all my nodes.
Right now, the only "half workaround" is adding the line
#include .stglobalignore

To the file .stignore, but I have to manually add this line in all my devices and that is not always easy to achieve.

Would be possible to have a second ignore file that gets synchronized between devices?

PS: One options that I saw in the forums was to always create a .stignore file with that line in all shared directories. If .stglobalignore is not present, nothing happens and if exits it works as intended.

Activity

  1. added
    enhancement
    needs-triage
    on Jan 29, 2021
  2. calmh commented on Jan 29, 2021

    @calmh
    Member

    Syncing ignore patterns is much trickier (or has much trickier effects, at least) than most people assume at first glance. It's often discussed, never implemented, so far. I don't see a specific issue for it other than the sprawling next-gen-ignores disaster so I'mma let this one stay for now.

  3. Mannshoch commented on Feb 11, 2021

    @Mannshoch

    Idea:
    Create a category [global] inside .stignore
    If a . stglobalignore appear, syncthing copy it's content (also section [global] ) to the global section of .stignore (replace all earlier content) add the log of this to .stglobalignore in the [LOG] section and rename the File to.stglobalignore-devicename-log file after that. If all connected client renamed this file, on the source machine several logs appear and you know which device is missing.

  4. imsodin commented on Feb 11, 2021

    @imsodin
    Member

    Please do not start yet another "ignore ideas" issue - there is already one with a whole lot of that: #2491. If you are actually interested in working on it, by all means share and discuss your plans. Otherwise there is no point in doing so.

    This issue is still open because I do believe the use-case will be solved by having "default-ignores" which get applied on folder creation. And I do intend to implement that.

  5. nshtg commented on Mar 5, 2021

    @nshtg

    Syncing ignore patterns is much trickier (or has much trickier effects, at least) than most people assume at first glance. It's often discussed, never implemented, so far. I don't see a specific issue for it other than the sprawling next-gen-ignores disaster so I'mma let this one stay for now.

    I just want Syncthing to ignore those damit .DS_Store files from MacOS by default...

  6. calmh commented on Mar 5, 2021

    @calmh
    Member

    So you want a default set of ignore patterns, which is something entirely different than a shared, synced set of ignore patterns.

  7. imsodin commented on Mar 6, 2021

    @imsodin
    Member

    User-configurable default ignores applied at folder creation: #7428

    Application defaults for such default ignores: #837

  8. removed
    needs-triage
    on Apr 29, 2021
  9. mrtimdog commented on Oct 5, 2021

    @mrtimdog

    All I have in use in my .stignore files is:
    #include .stignore.synced

  10. pagalba-com commented on May 11, 2022

    @pagalba-com

    All I have in use in my .stignore files is: #include .stignore.synced

    this leads to 100% CPU usage and sync fail/stuck/cyclic fail in case of file was deleted in synced directory and other nodes are also configured to use #include tag. I had even ALL the data lost in one folder, luckily on primary node Trash Can was enabled so I was able to recover.

    We really need a GLOBAL synchronizable configuration for ignore which automatically propagates to all new joined sync nodes.

  11. pagalba-com commented on May 11, 2022

    @pagalba-com

    By the way, the global ignore sync information could even be stored in share metadata, still having regular ignore file, then sections Local ignore and Global ignore should be separated and change would not be breaking for existing users and setups.

  12. imsodin commented on May 11, 2022

    @imsodin
    Member

    this leads to 100% CPU usage and sync fail/stuck/cyclic fail in case of file was deleted in synced directory and other nodes are also configured to use #include tag.

    That has been fixed: #8232

    I had even ALL the data lost in one folder, luckily on primary node Trash Can was enabled so I was able to recover.

    That doesn't seem related - anyway if you can reproduce please open a new bug ticket.

    Nowadays you can add a #include .stignore-shared or similar to your default ignores.

  13. acolomb commented on May 11, 2022

    @acolomb
    Member

    Nowadays you can add a #include .stignore-shared or similar to your default ignores.

    Just to be safe and make sure the shared ignore patterns actually do get applied right from the start, before the .stignore-shared file has synced, add this to your default ignore patterns:

    !/.stignore-shared
    *
    #include .stignore-shared
    

    After the folder has synced for the first time, just edit its individual ignore patterns and remove the single * line.

  14. pagalba-com commented on May 11, 2022

    @pagalba-com

    this leads to 100% CPU usage and sync fail/stuck/cyclic fail in case of file was deleted in synced directory and other nodes are also configured to use #include tag.

    That has been fixed: #8232

    Thats great!

    I had even ALL the data lost in one folder, luckily on primary node Trash Can was enabled so I was able to recover.

    That doesn't seem related - anyway if you can reproduce please open a new bug ticket.

    Nowadays you can add a #include .stignore-shared or similar to your default ignores.

    This still does not solve the issue of Global ignore I mentioned here and here.

    This relates to multi platform nodes and version control dirs especially when new nodes join the share. Every node should be manually configured for every share joined now, and this is real PITA especially if share is sent to regular 'computer user' who calls browser 'Google' 😃

  15. Kaelber commented on May 11, 2022

    @Kaelber

    The process is a bit mysterious to me. I use the two files shown on all devices (Linux, Windows, Android) and in all folders.

    grafik

    With one special exception, the .stignore only contains "#include .stglobalignore" (nothing else) and I had to distribute this file once because it is not synced. The .stglobalignore is synced perfectly across all devices and folders and in no way leads to 100% utilization. Would it be possible that the dash "-" or point "." in your name interferes?

    It's a pity that this global option is only folder-related, which is why I would also like to be able to set up global and device-related ignore patterns.

  16. pagalba-com commented on May 11, 2022

    @pagalba-com

    In my case problem arised for shares with 1GB and 300 items, and another one with 44GB and ~650k files.
    Still there was auto-accept from master setup on that node, and somehow this led to delete of all contents of first share, this delete spread across all nodes, and all of then entered cyclic fail loop leading to 100% CPU usage. I hope that mentioned fix 8232 will avoid that situation again because of missing ignore file.
    May be this was sync failure related, not sure, but I suspect that joined node empty share made a delete command to other nodes.

    I have also exact setup with two files, where another is called .stgignore and .stignore contains only one include line.

  17. imsodin commented on May 11, 2022

    @imsodin
    Member

    I didn't say it does address this issue fully, otherwise I'd have closed the ticket ;)
    I just explained what other changes have been made that make the use-case here a bit less annoying.

    And github tickets are not for discussions/support - please use https://forum.syncthing.net if you have any further questions or want to discuss workarounds. The forum has a lot more eyes and friendly people on it than the issue tracker. Thanks!

  18. Jip-Hop commented on Jun 5, 2022

    @Jip-Hop

    Nowadays you can add a #include .stignore-shared or similar to your default ignores.

    Just to be safe and make sure the shared ignore patterns actually do get applied right from the start, before the .stignore-shared file has synced, add this to your default ignore patterns:

    !/.stignore-shared
    *
    #include .stignore-shared
    

    After the folder has synced for the first time, just edit its individual ignore patterns and remove the single * line.

    This pattern didn't work for me. The new folder is stuck in Waiting to Sync state and I get the following warning:

    Loading ignores: parse error: failed to load include file .stglobalignore: open /Users/macos/Sync/test/.stglobalignore: no such file or directory

    Error on folder "test" (rewxw-scvru): loading ignores: parse error: failed to load include file .stglobalignore: open /Users/macos/Sync/test/.stglobalignore: no such file or directory

    I now use this as default ignore pattern instead:

    // Only sync the .stglobalignore file initially 
    !/.stglobalignore
    
    // EDIT: uncomment the line below once the .stglobalignore has been synced
    // #include .stglobalignore
    
    // EDIT: edit and uncomment lines below once .stglobalignore has been synced to selectively sync some folders
    // !/Pictures
    // !/Work
    
    // Ignore everything else by default
    *
    

    This way on initial sync only the .stglobalignore will be synced. Once that's done I can 'selectively' sync some subdirectories (or everything else by removing the asterisk).

  19. added theissue type on May 30, 2025
  20. added 3 commits that reference this issue on Jun 13, 2026
    ecbb1a7
    d99aec4
    caab03f
  21. Enerccio commented on Aug 20, 2026

    @Enerccio

    this leads to 100% CPU usage and sync fail/stuck/cyclic fail in case of file was deleted in synced directory and other nodes are also configured to use #include tag.

    That has been fixed: #8232

    I had even ALL the data lost in one folder, luckily on primary node Trash Can was enabled so I was able to recover.

    That doesn't seem related - anyway if you can reproduce please open a new bug ticket.

    Nowadays you can add a #include .stignore-shared or similar to your default ignores.

    its not, syncthing will STILL have high cpu usage if one side is sending a change that is ignored. Not syncing .stignore is huge gotcha that NO ONE expects!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions