Git Feature in Publii v.0.44.0 Alpha
-
October 19, 2023 at 11:42 am #10753Bob
Hi,
We are introducing Git repository support in Publii version 0.44.0 Alpha. This release aims to facilitate rigorous testing of this new feature within our user community.
Note that this is an alpha release; we strongly advise backing up all crucial files and websites before using this version.
Deprecation of GitHub and GitLab
Starting with version 0.44, support for GitHub and GitLab will be deprecated. We plan to entirely remove them from Publii in version 0.46, likely in early 2024.
Advantages of Using Git
Utilizing Git for website data synchronization offers a more efficient, faster, and stable alternative to using the APIs of mainstream repository storage platforms. Publii is now fully compatible with any SaaS offering Git repository support. This includes GitHub, GitLab, Bitbucket, and even your own repository server.
How It Works
Publii fetches the content from your repository prior to rendering your website. During synchronization, any changes you’ve made will override the existing repository state. A commit consisting of the modified files will then be created and pushed to your repository.
Note: Changes made directly to your repository will not affect your website content, as it will be superseded by the rendering process and the newly generated commit.
Configuration Steps
- Navigate to server settings and select ‘Git’ as the server type.
- You will then be prompted to enter the Git repository settings:
- Repository URL: The URL of your Git repository.
- Branch: Typically ‘main’ or ‘master’.
- Username: Your username for the chosen repository SaaS.
- Password: Your password or personal access token.
- Commit Author/Email and Message: These fields will populate the commit metadata.
Download Publii v.0.44.0 Alpha
October 19, 2023 at 12:34 pm #10764[anonymous]And it works!
Confirmed just now, thanks, so much for the update.
MPT
October 21, 2023 at 10:35 am #10776[anonymous][anonymous] wrote:<h2>How It Works</h2>
Publii fetches the content from your repository prior to rendering your website. During synchronization, any changes you’ve made will override the existing repository state. A commit consisting of the modified files will then be created and pushed to your repository.Note: Changes made directly to your repository will not affect your website content, as it will be superseded by the rendering process and the newly generated commit.
Can you clarify a bit on the How It Works paragraph? The way it’s described doesn’t sound exactly like the workflow I’m used to for Git in Visual Studio Code for example, or am I just not reading it right?
When I start VS Code I can see in the lower left corner if there’s been any changes made to the repository and I can just click a button to sync those changes. This makes it easy to work with the same repository from multiple devices or with multiple users. If Publii’s Git integration will work like this, it would make it possible to work on the same site from multiple devices. Is there any reason why it shouldn’t work like that?
October 21, 2023 at 11:35 am #10778[anonymous]@jabchew – this feature is not dedicated for syncing website between devices, but for syncing local website with repository in one direction. In fact two-way sync is impossible in this way, because you should sync the input files of the website too. And then use them to render website.
At this moment we have focused to allow use of git to sync output files with repository as fast as possible.
October 21, 2023 at 1:03 pm #10779[anonymous]Tomasz Dziuda wrote:@jabchew – this feature is not dedicated for syncing website between devices, but for syncing local website with repository in one direction. In fact two-way sync is impossible in this way, because you should sync the input files of the website too. And then use them to render website.
At this moment we have focused to allow use of git to sync output files with repository as fast as possible.
Ok, so syncing only handles the `C:\Users\%username%\Documents\Publii\sites\site-name\output` folder and in one direction – to the Git repository – and it will overwrite whatever content that may have been added there outside of Publii?
I see how syncing all of the folders could be an issue as it would mean duplicates of media for example, which might practically double the storage used.
I’m guessing that the only practical way of multi-device usage for now is to use the Dropbox solution, which should work with just about any similar service like OneDrive or Proton Drive, and then just configure Git sync in Publii on all devices.
October 25, 2023 at 4:46 pm #10831[anonymous]Publii v44 can’t find the website files and post anymore after I changed the website name in settings. I forgot to screenshot the error but you can try.
Have some posts in publii 44, go to settings, change website name, save, try to go to a post.
October 30, 2023 at 8:53 am #10854[anonymous]Wonderful solution… but there is a main point that is blocking me from using it: username and password of my git SaaS are stored in clear in the site.config.json.
If I may take the liberty of making a suggestion.
All the deployment part should be saved in a separate settings file, even better if encrypted (https://doc.libsodium.org/ could be an instrument).
October 30, 2023 at 9:34 am #10856[anonymous]JoZ – thank you for spotting this – I was pretty sure that the password for git is stored via secure storage, but it seems that there is some bug to fix during saving deployment settings. As you can see – password for FTP is properly stored – with use of website UUID.
October 30, 2023 at 10:03 am #10857[anonymous]aaart – I will check this case too – if I will be able to reproduce it, then I will fix it 🙂
November 9, 2023 at 1:36 pm #10948[anonymous][anonymous] wrote:Publii v44 can’t find the website files and post anymore after I changed the website name in settings. I forgot to screenshot the error but you can try.
Have some posts in publii 44, go to settings, change website name, save, try to go to a post.
I saw that in earlier versions. Perhaps it is a regression. If you exit and return is the newly named site available?
November 11, 2023 at 3:14 pm #10961BobPublii CMS v. 0.44.0 (no longer in alpha) is now officially released! This milestone could not have been achieved without the invaluable feedback and contributions from all of you during our 0.44 alpha phase with Git support.
With the official version 0.44 now available, we will be closing this thread to focus on the new release. We encourage everyone to continue sharing their experiences and feedback on the latest version. Your continuous input is what helps us keep improving and evolving.
Thank you once again for your dedication and help.