I have recently made a website using Kirby. I currently update my code changes via SFTP. I use the web panel to update my projects page. Thus, my local files do not mirror the changes on the web, is there any method for me to fix this?
And/or a method to keep my kirby files in sync in general, without me having to use a client like FileZilla?
I followed your tutorial on GitHub, and I think I’ve successfully installed it, I see a versions tab under the panel burger menu.
Would I be correct in assuming that when I push changes to my Git repository it will reflect on my site? Or is this just more for version control, and if so, how do I sync the current version on my site to the local one?
You can extend that to also pull the repo (including tags) in the cronjob. Alternatively you can set up your repo on the web server as a remote for your local repo and pull/push directly.
Please keep in mind that the Versions plugin only displays Git tags, not individual commits. Easiest would be to use the plugin locally as well to create versions.
The local and live instances don’t “see each other”, so you cannot configure both instances locally. The local installation should only have the “local instance” configured and the live installation only the “live instance”.
I’m pretty sure the Git version on your server is too old. The plugin requires Git 2.5+ (ideally newer).
I’m sorry, but I feel like the Versions plugin is not the right fit for your setup.
rSync as suggested by James may be better suited as it doesn’t require much initial setup. There are also GUI tools for rSync available (depending on your operating system). I don’t have personal experience with either of those however.
If you do go the rSync route, the version bundled with MacOs isnt the most current. Easily fixed via homebrew though.
rSync does require a host that supports SSH connections, as it does the transfer over a secure SSH tunnel. A lot of super cheap shared hosts dont allow this, but easy enough to find one that does. Its worth doing though, as its roughly 10x faster than SFTP and after the first push, it will only transfer the files that have changed.
I should also point out one gotcha with rSync. It does a 1:1 mirror from source to target. It will delete stuff on the target that does not exist on the source. Its possible to deploy to the server from your local machine, and also in the other direction.
The gotcha is that Kirby numbers folders in the content folder. If the pages have been reordered on the server and you pull from remote to you local machine, you can end up with duplicate folders with a different number prefix in rare occasions.
I use Git for version control and to combat this, i do a commit locally to git, then manually trash my entire content folder from my local copy. Then i do an rSync from remote to local. This gives me a good copy of the the content folder. then i commit and work on my changes, before pushing back the other way to the live server.
Thank you so much for the detailed response, @jimbobrjames! Really appreciate you.
I’m going to go through the link you sent me and see if I can figure it out because using SFTP is proving to be a massive pain especially when the changes are pretty incremental. I google’d it and Namecheap does support SSH in the cPanel so hopefully I’ll be able to get this thing working!