Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Git Feature in Publii v.0.44.0 Alpha

  • #10753
    Avatar photoBob

    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

    1. Navigate to server settings and select ‘Git’ as the server type.

      img1

    2. You will then be prompted to enter the Git repository settings:

      img2

    • 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

    #10764
    Avatar photo[anonymous]

    And it works!

    Confirmed just now, thanks, so much for the update.

    MPT

    #10776
    Avatar photo[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?

    #10778
    Avatar photo[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.

    #10779
    Avatar photo[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.

    #10831
    Avatar photo[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.

    #10854
    Avatar photo[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).

    #10856
    Avatar photo[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.

    #10857
    Avatar photo[anonymous]

    aaart – I will check this case too – if I will be able to reproduce it, then I will fix it 🙂

    #10948
    Avatar photo[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?

    #10961
    Avatar photoBob

    Publii 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.

    Learn more about Publii CMS Version 0.44.0