This is a plugin for Kirby that commits and pushes changes made via the Panel to your git repository.
Just keep using the Panel as you are used to and watch the commits appear in your git repository!
An environment supported by Git.php. In particular, proc_open
needs to be enabled.
Create a new git repository where you push your content to, name it your-project_content
.
Init the content repository and push it.
Remove the content/
folder from your current git repository:
git rm --cached -r content
git add -A
git commit -m "Move content folder to separate repository"
Add the content/
folder to new git repository:
cd content
git init
git remote add origin https://github.com/your-project/your-project_content.git
git add -A
git commit -m "Initial Content Commit"
git push origin master
Go into your site/plugins/
folder and
git submodule add --name git-commit-and-push-content https://github.com/blankogmbh/kirby-git-commit-and-push-content.git site/plugins/git-commit-and-push-content
cd site/plugins/
git submodule update --init --recursive
If you installed kirby via composer open your project's composer.json and add
blankogmbh/kirby-git-commit-and-push-content
as a requirement and a custom path so it will be installed into the site/plugins folder.
That's what your composer.json will look like afterwards:
{
"name": "your-company/your-project",
"require": {
"mnsami/composer-custom-directory-installer": "1.1.*",
"getkirby/kirby": "^2.4",
"getkirby/panel": "^2.4",
"blankogmbh/kirby-git-commit-and-push-content": "1.*"
},
"extra": {
"installer-paths": {
"./kirby": ["getkirby/kirby"],
"./kirby/toolkit": ["getkirby/toolkit"],
"./panel": ["getkirby/panel"],
"./site/plugins/git-commit-and-push-content": ["blankogmbh/kirby-git-commit-and-push-content"]
}
}
}
Put all the files into your site/plugins/git-commit-and-push-content/
folder. If the git-commit-and-push-content/
plugin folder doesn't exist then create it.
You can use the following Options - make use of kirbys Multi-environment setup.
(In case you need to use multiple git users on your environment - Multiple SSH Keys settings for different github account)
If you do not want to pull and/or push on every change you can also call yourdomain.com/gcapc/push
or yourdomain.com/gcapc/pull
manually (or automated with e.g. a cronjob).
Type: String
Default value: kirby()->roots()->content()
Path to the repository to work in.
Type: String
Default value: ''
Branch name to be checked out (defaults to currently checked out branch).
Type: Boolean
Default value: false
Pull remote changes first?
Type: Boolean
Default value: false
Commit your changes?
Type: Boolean
Default value: false
Push your changes to remote?
Type: Boolean
Default value: true
Whether yourdomain.com/gcapc/push
and yourdomain.com/gcapc/pull
are enabled or not.
Type: Boolean
Default value: true
Show or Hide the Panel widget.
Type: String
Default value: ''
The location where git can be found.
See Git.php void Git::set_bin ( string $path )
Type: Boolean
Default value: false
See Git.php void Git::windows_mode ( void )
Your repository might increase in size over time by adding Images, Audio, Video, Binaries, etc. Cloning and updating your content repostory can take a lot of time. If you are able to use Git LFS you probably should. Here is what the .gitattributes file could look like:
*.zip filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
Pascal 'Pascalmh' Küsgen http://pascalmh.de