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.

Server type “GIT Repository” issues with GitLab

  • #11309
    Avatar photo[anonymous]

    The existing post on GitLab issues was closed, but that did not solve my issues with “GIT Repository” server type using GitLab..
    Synchronising via server type “GitLab” occasionally works, so I stil have a non-reliable alternative.

    For both server types I use the same settings for “Website URL”, “Repository” and “Branch” and “.gitlab-ci.yml” file, so I assume these are correct. But for completeness these are my settings:
    + Repository URL: https://gitlab.com/h-intveen/wtg
    + Branch: main
    + “public” folder already exists in this directory

    Furthermore I use my GitLab credentials as Publli settings:
    + Username: h-intveen@gitlab.com
    + Password/Token: <the “wtg” access token”>
    I have 2FA enabled and created an access token “wtg” with role “owner” and all permission  levels enabled.
    The directory I am using with Gitlab is: https://gitlab.com/h-intveen/wtg

    “Test connection” shows “Checking connection…” but never gives results.
    “Sync your website” results in HTTP Error: 404 Not Found, logs:

    deployment-process.log
    Git debug: add = 404.html

    Git debug: git add done
    Git debug: changes exists = true
    Git debug: commit done
    [Thu, 14 Dec 2023 11:51:47 GMT] ERROR: HttpError: HTTP Error: 404 Not Found

    There are no errors in the other files.

    When I try “Sync your website” again, it passes though nothing changed and no files are synced: that is clearly an error.
    Looks like there are still issues to be solved before removing Gitlab….

    I have also tried disabling 2FA  and using my Gitlab password in “Password/Token” but that resulted in the same error.
    So either I don’t know the correct settings, or publii syncing causes the error.

    #11341
    Avatar photo[anonymous]

    Hi,

    I have found few small issues in the current Git implementation, but there are not related to your issues. In fact I am unable to reproduce the 404 Not Found error :/ I have even tried to provide wrong repository name, but then new private repository has been created. So at this moment I have no idea how can I help with your case. If there will be more details which can help to investigate this issue – please let me know

    #11346
    Avatar photo[anonymous]

    i read your reply to the close issue: “right – I have used new name for the main branch, while older repositories can still use “master””.
    I don’t know what you mean by this, I have always used a very simple setup with only 1 “main” branch (so it is default) and a few files.

    Because of this I created a new branch “master” and set this to de the default branch.
    So I now have 2 different server configurations in Publii:
    + ‘old’ server type “GitLab” with Branch set to “main”
    + ‘new’ server type “GIT Repository” with Branch set to “master”

    When I now try to sync my site I get Critical error: NotFoundError: Could not find master
    I restarted my Mac, edited a post and synced again but this error persists.

    deployment-process.log
    Git debug: add = .gitlab-ci.yml
    Git debug: add = 404.html
    Git debug: add = WTG 2019.pdf
    Git debug: add = WTG Lets Gro 2019.pdf
    Git debug: add = april-2023.html
    Git debug: add = assets/css/editor.css

    Git debug: changes exists = true
    Git debug: commit done
    [Wed, 20 Dec 2023 12:15:16 GMT] ERROR: NotFoundError: Could not find master.

    No surprise but the GitLab repository “https://gitlab.com/h-intveen/wtg” in branch: “master” stays empty.

    #11349
    Avatar photo[anonymous]

    Please try to remove the whole output directory from your site directory and create empty output folder manually – maybe it will help, because it can be connected with one bug which I have found in the meantime

    #11373
    Avatar photo[anonymous]

    I have removed all files from my https://gitlab.com/h-intveen/wtg repository (so public folder and .gitlab-ci.yml) and tried to sync .
    The result is the same: ERROR: NotFoundError: Could not find master.

    For completeness the contents of root-file: .gitlab-ci.yml

    image: alpine:latest
    pages:
    stage: deploy
    script:
    – mkdir .public
    – cp -r * .public
    – mv .public public
    artifacts:
    paths:
    – public
    only:
    – master
    #11374
    Avatar photo[anonymous]

    Could you try to remove site output directory and then create a new empty output directory? I suspect that initially you have used different repository URL which has no “master” branch and then changed repository URL to the current one. I have discovered that after such change local repository is still binded to the old repository (it will be fixed in v.0.44.2 which will be released soon).

    I do hope it will help 🙂

    #11389
    Avatar photo[anonymous]

    A friend pointed out that it was not wise to have two root branches master and main.
    So I deleted the master branch and changed the .gitlab-ci.yml file accordingly.
    That did not help, but the setup is really minimal now: only 1 branch called main with an empty repository.

    After this I removed the Publii output directory as requested and tried to sync again.
    The resulting was an error , but a different one, a PushRejectedError.
    A screenshot of the error:

    Scherm­afbeelding-2023-12-23-om-14.00.02

    As expected no files were created in the repository https://gitlab.com/h-intveen/wtg

    For completeness the contents of changed root-file: .gitlab-ci.yml

    image: alpine:latest
    pages:
    stage: deploy
    script:
    – mkdir .public
    – cp -r * .public
    – mv .public public
    artifacts:
    paths:
    – public
    only:
    – main
    When I sync again (and again and again ..) it succeeds, but no files are uploaded.
    If I edit a post and sync the error returns: PushRejectedError
    #11398
    Avatar photo[anonymous]

    That’s weird, because such issue should occur only if you have old .git catalog in the output directory which is out of sync with your repository. Maybe you have removed wrong output catalog?

    #11399
    Avatar photo[anonymous]

    My Publii files reside on my Mac in the /Users/herman/Documents folder.
    Website “wtg” resides in /Users/herman/Documents/Publii/sites folder and contains the input, output and preview folders.
    I deleted that output folder .

    The folder it is re-created and poopulated on “Preview your changes” or “Sync your website”.
    That should be the correct one….

    #11405
    Avatar photo[anonymous]

    Did you applied any changes on the repository after first rendering/sync? As I understand your repository is totally empty? Could you try to put in it any file like test.txt with “test” string inside and then try to sync website? Maybe it is an issue with fact that repository is totally empty

    #11413
    Avatar photo[anonymous]

    I emptied my repository manually from the GitLab IDE: I removed all files and committed the changes.
    So my repository was totally empty.

    Today I created a dummy “test.txt” file in the “wtg” repository and installed Publii 0.44.2 and synced again.
    The result is still the same: PushRejected Error.

    A friend suggested that there might be an issue where the git status gets incorrect due to multiple changes.
    A fast-forward should help, but I don’t know how to force this with the GitLab IDE.

    As a last resort I am about to clone the repository to my Mac and try to get things working from there.

    #11416
    Avatar photo[anonymous]

    As a workaround I cloned the repository via terminal to my Documents folder (same as where my Publii files reside):
    herman@iMacHerman Documents % git clone git@gitlab.com:h-intveen/wtg.git

    |Opened the resulting folder “/Users/herman/Documents/wtg” with VSCodium.
    After cloning I performed a commit  and a fast-forward from the VSCodium terminal window:
    herman@iMacHerman wtg % git commit
    On branch main
    Your branch is up to date with ‘origin/main’.

    nothing to commit, working tree clean
    herman@iMacHerman wtg % git push –force-with-lease
    Everything up-to-date
    herman@iMacHerman wtg %
    So according to git everything is up-to-date, looks like this was not necessary after all.

    Next I copied all files excluding the “.git” folder from the Publii/sites/wtg/output folder and pasted them into the repository.
    In VSCodium I staged all the files and performed a commit.
    As a result the GitLab repository wtg is populated with all of Publii’s output files.
    So getting the files there with git should not be the problem.

    Shortly after I receive a GitLab notification: wtg | Failed pipeline for main | 3b2075bf
    Scherm­afbeelding-2023-12-26-om-14.25.20
    The pipeline displays error “yaml invalid”
    However I don’t see what is invalid….

    Now I tried a sync from Publii again, but this again results in the PushRejectedError.
    Hope my exercise results above give you a clue on what’s going wrong…

    #11424
    Avatar photo[anonymous]

    After fixing an .gitlab-ci.yml indentation error the pipeline now succeeds.
    So updating GitLab via VSCode now works fine.

    After copying the .gitlab-ci.yml to /Users/herman/Documents/Publii/sites/wtg/input/root-files I retried the Publii sync.
    However the result is still the same: PushRejected Error.

    No more clues left…..

    #11426
    Avatar photo[anonymous]

    Hi,

    I will try to find a reason why do you get at all the PushRejected Error and I will try to implement some fix for such situation. Please let me few days to find a solution.

    #11427
    Avatar photo[anonymous]

    Thanks Tomasz!
    You can use my GitLab project to debug if you want.
    Please  let me know, if you want to I will give you the token.