New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Solved] - how to add the user/themes dir to the sync #21
Comments
Ok, I found a way to do it! It was already there but hidden, for some reason. Here's how I enabled it, I hope others will find it useful too: I poked around in the plugin files to see if there was a way to achieve this, and sure enough, in
Changed it to:
... and this made the hidden option appear in the plugin settings in the admin module. It still wasn't pushing the So I changed
And presto! It now syncs the themes folder too 😸 Why on earth was this hidden? And there's no mention of it in the docs. Recent addition I guess? Again, thanks a lot for the awesome work! |
It's hidden because there are some implications when using anything but pages. Themes for instance is not something that can be automatically synced (same goes for plugins). If you do themes changes most likely you are developing it by creating files or editing CSS, etc. there is no event on grav to trigger any synchronization based on those changes and so you have to manually sync yourself which will make it somewhat useless in one way. Config/Data/Accounts could be detected by grav events and they are but I have huge concerns on allowing those. Both can be containers of sensitive data like passwords, users, tokens, addresses, phone numbers, etc etc. this is all fine and good if you are aware and know what you are doing, especially if you are dealing with a private repository. However this could go wrong so easy in so many different ways that I'm just very hesitant about allowing the plugin to sync those folders. That explains why the feature is hidden but functional. It's been implemented since the beginning, any folder under I still have plans on exposing those fields , I just want to add proper warnings and concerns around it. Hope that answers your questions 🙂 |
That's exactly the scenario I had in mind. One should be developing locally anyway, not on the server :) But the client will edit the content on the server, via the admin plugin, so it gets pushed to the git repo and synced down to our local environments.
So far I'm the only one learning Grav in our team, but I'm spreading the good word and will collaborate with a teammate on a project soon. Will let you know 😄 Thanks for your answer! |
Hmm, well I would like to see a solution where you can git sync your entire site(user folder) except users and sensitive data. |
HOW TO INCLUDE OTHER FOLDERS THAN PAGES TO THE REPO I also wanted to sync the whole user folder so I changed some config-files and now it works (bi-directional). Note that as @w00fz pointed out, for other dirs other than pages the changes will be not automatically pushed. 1. Change to the installation folder of grav (e.g. grav-admin)
3. This is working for GitSync v1.0.3 and might not working any more if the logic of configuration files was changed PS: To manually commit changes cd to your root/user dir and do |
I think this makes the most sense if you use the most common git strategy, which is the use feature branches and then merge into a master or staging branch. The way I set this plugin up is to include the almost the entire user folder, just like @biocarl did. And I set the production site to sync with master and my dev machines to sync a feature-specific branch or develop branch. That way my live site's theme and theme css doesn't get updated until I merge my develop branch into master. Using this method you can even technically have staging/beta servers setup as well. And everything can stay in sync and developers always have the latest content from production whenever they sync their master branch. But I do understand that not everyone may have this setup in mind. It would be nice if it was easier to enable all the user folders to sync though. |
Awesome plugin, but I was surprised that it only syncs the user/pages folder. Why not have an option to sync the user/themes folder too, that would be very welcome during theme development when working with a team (so we won't have to set up another git repo with commit hooks for that).
Thank you for the awesome work!
The text was updated successfully, but these errors were encountered: