trilbymedia / grav-plugin-git-sync

Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Apache License 2.0
243 stars 58 forks source link

doesn't work in a multisite env #33

Closed tourtools closed 6 years ago

tourtools commented 7 years ago

when trying to sync or when modifying pages it logs:

grav.NOTICE: gitsync[command]: LC_ALL=en_US.UTF-8 cd /var/www/.../user/ && git status 2>&1 [] [] grav.NOTICE: gitsync[output]: # On branch master nothing to commit (working directory clean) [] []

there's a way to tell the plugin, maybe through its config file git-sync.yaml, in which path has to work?

tourtools commented 7 years ago

or maybe through the definition of a "git-sync" stream in the /setup.php?

w00fz commented 7 years ago

I'm not sure I understand the issue, the log looks correct to me. Gitsync is trying to sync your user folder, it's setup to ignore everything but pages, sees pages are up to date and doesn't need to pull/push

tourtools commented 7 years ago

it refers to a multisite installation, the gitsync is triggered from a site in the dir /user/sites/foo.bar, where the plugin is installed, but the git status is executed on the /user/ root

pages in /user/sites/foo.bar/pages are changed, but it looks to the /user/pages dir which belongs to the main site of the multisite install.

it would be great if git-sync was aware of the site from which is triggered also in a multisite env.

Just-Insane commented 6 years ago

This still appears to be an issue. When in a multisite environment, one has to copy the plugin files into the user/sites//plugins folder (from the /plugins folder).

On top of that, when using the wizard, it does not seem to automatically create the git repository for the current site. This prevents the plugin from being used in a multisite Grav setup.

Edit: After looking at the .git in webroot/user, it turns out that git-sync is overwriting THAT git repo and corresponding files. Therefore, to get the git repo setup for the multisite, you have to run the config, then copy the git repository files into the correct site's folder. Though, this seems to be the way you have to do multisite for everything in Grav unfortunately.

After further testing, my above workaround does not appear to work. I'm assuming this is because the git-sync is being run from webroot, as opposed to the sub-site. Therefore, it is only syncing the default site, not the sub-site of Grav.