Syncronize .stignore file

Hi. Reading documentation I see that .stignore file is not synchronized (it is ignored).

I have a master repository (a complete web site) that i’m developing and it is synchronized to about 20 nodes using syncthing. The repository includes some folders that should be ignored because they are temporal folders, smarty chache, etc. The problem that I have is that I need to manually set .stignore in each node, this is difficult because when I change, add or delete folders in master repository that should be ignored in all nodes, this is madness and sometimes and I don’t have access to the remote nodes to manually change the .stignore.

Is there any option to force .stignore file to be syncronized to other nodes. May be a .stglobalignore file that should be syncronized by default?

With best regards Christian

If the folders are ignored on the “master” repository, they will not be synced to the other nodes, so there is no need to ignore them there.

However, madness or not, there’s a workaround you can use, at least if the involved machines are Unixy (Linux, Mac, FreeBSD). Rename your .stignore to just stignore (no leading dot. Or whatever other filename you like, that is not exactly .stignore) then create a symlink .stignore -> stignore.

The end result is a file that is synced (stignore) and contains the ignore patterns. The symlink needs to be created just once on each node and will thereafter be left alone.

1 Like

After reading your response in “exclude exactly one folder in .stignore”, I see that this will not work for me, because I’ll need to do a symlink in any new subfolder where I set a .stingoner file, that is the same work that creating the .stignore file.

Let me explain my working model. I develop some large web project and I push my git commits to a server of my own, this server after any push, trigger a script that checkout master branch to a working dir in the same server and then make some compiling, checks, bla bla, to the files. This working dir is configured as “master” in SyncThing and synced to several customers nodes where I deployed my proyect. At present, if I commit a change in the proyect that results in the need to exclude new files or folders, after the commit, I need to connect to every customer server using ssh (not always I have permanent access) to make new .stignore files en each subfolder that I need to exclude.

What do you think about my proposal of have 2 diferent files?: .stignore (local and private ignore file) that is not replicated. .stglobalignore (public and shared ignore file) that is replicated. Using the concatenation of this 2 files anybody can configure diferent folder and files to be public o locally ignored.

With best regards Christian

Yes, that’s probably an OK solution.

May I ask if solution with .stglobalignore was already implemented?

Yes. Put your patterns in .stglobalignore, then add #include .stglobalignore to the .stignore file on all hosts that should use the synced patterns.

1 Like

My apologies for resurrecting this old thread, but it’s the most specific one I found for my question: Is there a fundamental reason why syncthing doesn’t sync .stignore files? If not, How about adding it as an option?

My use-case is syncing (between work PC and MacBook) a project folder, of which some sub-folders are git repositories. Some of them are individually synced with GitHub. From experience I learned to avoid conflicts between git’s and syncthing’s syncs by adding the sub-folders’ names to both .stignore files. This would be easier if there was a “sync ignore patterns”-option.

Just add them on both ends, or use the #include directive as explained in the wiki

I did, but that (with all due respect) is not an answer to my question(s) :wink:

*edit

This is an existing issue, see https://github.com/syncthing/syncthing/issues/1392

The question is why is stignore not synced. The answer is, because if I only want to sync my music on my phone, suddenly all devices only sync music, which is not what you want.

Yeah sry, I was referring to the second part of the message

Ah-ha, thanks! Do I understand correctly that this scenario would involve one repo for all the phone’s data, but with everything except the music ignored? I can see why the .stignore files would need to remain isolated then.

However, in the case I describe, new ignore rules have to be added as the project progresses.

… and @AudriusButkevicius has given you a good solution for that already

I am using that solution, but I see it more as a work-around, because I can’t access the included file through Syncthing. Still hoping & voting for a sync .stignore file option.

My 2 cents: having configurable behaviour like this is all well and good, but too much of it is a Very Bad Thing. When you’ve got loads of little configuration switches which all control different aspects of your application, then it becomes very hard to reason about what behaviour your application should be exhibiting, unless you go and find out the value of each separate configuration option, hold them all in your head, and figure out the end result.

One symptom of this is help requests that read something like “HALP! I don’t know why Syncthing isn’t doing FOO”, then later “Oh, nevermind, I forgot I’d set switch BAR to BAZ”.

Instead of having lots of little switches which tweak behaviour, it’s better to have a single unified approach which covers all (or at least, most) use-cases. In this case, the pain is that you can’t access/edit the included file through Syncthing’s web GUI. Therefore, wouldn’t a better solution be better support for .stignore #includes in the web GUI?

2 Likes

Yep, that’s a better idea :smile: