I made a Plugin to version control the content folder using git. Using the kirby panel hooks everything that can be hooked into will be staged, committed and pushed to its own git repository.
The git history will look like this:
sort(page): team/max-mustermann by kirby-panel-username 136b20af
upload(file): team/max-mustermann/max-mustermann.jpg by kirby-panel-username ede54f13
update(page): team/max-mustermann by kirby-panel-username d79daee5
create(page): team/max-mustermann by kirby-panel-username 853992b3
Let me know what you think, contributions are more than welcome!
Thanks for your plugin!
I followed the instructions and I don’t seem to get it to work…
It seems it’s a problem when $repo = Git::open(’…/content’); is called since it never comes back.
I see some Exceptions can be thrown in the code but I don’t know exactly how do you they are displayed in the panel even when debug is set to true. They seem to be suppressed somehow.
Do you have some tip on how to debug your plugin?
Any hint is appreciated
You can open the Dev Tools in your Browser and select the Network-Panel. When you hit “Save” in the Kirby Panel there will be a new Request if you click on it and check the Response there will be the error message you are looking for.
Hi Thanks for the response. I’ve tried your suggestion but I don’t see any errors popping up there only some html being returned with a 200 status. So the exceptions are not being returned from git.php. I think you are talking about the echo messages in your code directly.
Here more background on what’s happening:
One reason could be that your webserver and therefore PHP runs as a different user than on your shell. You should be able to fix this by running the commands directly in the repository and leaving out the --global option so that the values are saved to the content repository.
Thanks Pascal, both are installed and present on the server. I’ve added push and pull options. However, I haven’t been able to get it to work, manually committing and pushing the changes in the content folder to github via SSH does work. You’ve mentioned in previous posts that errors should show up in the Network pannel when using Dev Tools. When I save using panel, I get a XHR with status code 200, and some json is returned, I don’t see any errors coming from the plugin, which makes this a bit hard to debug. Do you have any suggestions as to what I might try?
I just pushed a new Version (1.1.1) where some stuff got refactored, can you try it again with the newsest version? And could you give me the Git Commands you are using when you commit and push manually on the server?
Hi Pascal, I’m afraid I’m still running into problems, I’m hoping you can spare some time to have a look. I’ve tried to simplify by just working with a vanilla kirby installation.
I’ve set up some public repositories to allow you to have a look at what might be wrong. Both can be found here:
gcapc-test contains a vanilla kirby installation (2.2.3), and I followed your readme to my best abilities. the content for this kirby installation is in gcapc-test-content. As far as I can determine your 1.1.1 update and Git.php are installed succesfully from github.
Currently when running this installation with php on the commandline, (OSX 10.11.4) it returns the following error:
/ - parse error, expecting `’)’’ in /Users/username/Development/02_Github_Public/gcapc-test/site/plugins/git-commit-and-push-content/helpers.php on line 14
I’m a bit stumped as for what might be wrong, because that line seems fine to me…
It might be obviouse for some but the plugin doesn’t work when git is not correctly configured for the user running the php process. Unfortunately the plugin fails silently and doesn’t catch that error.