jimporter / mike

Manage multiple versions of your MkDocs-powered documentation via Git
BSD 3-Clause "New" or "Revised" License
511 stars 45 forks source link

how to exclude forbidden files (sitemap.xml.gz) #174

Closed Siroccomeister closed 9 months ago

Siroccomeister commented 9 months ago

Hello - am trying to run mike versioning on Material for MkDocs. It is on a private Gitlab and one of the server rules is to prevent any compressed file to be upload (.gz). But mike deploy seems to systematically create the sitemap.xml.gz file within gh-pages branch. And when I try to push it - it creates an error.

remote: Resolving deltas: 100% (64/64), done. remote: ERROR: 0.1/sitemap.xml.gz filetype is forbidden remote: error: hook declined to update refs/heads/gh-pages ! [remote rejected] gh-pages -> gh-pages (hook declined)

Listing explicitly this file in .gitignore or /info/exclude does not fix this. If I remove the file from the repo/site/ folder, it still remains in the gh-pages branch prior to the git push.

Any idea how to work around this? I know that mike is primarily tasked to work on GitHub. But it would be useful to get the above resolved

Thanks !

jimporter commented 9 months ago

Have you tried this with MkDocs (e.g. mkdocs gh-deploy), and without mike? I think this is a bug in MkDocs itself, since it's responsible for generating sitemap.xml.gz.

Of course, it wouldn't be hard for you to work around if you wanted something right away: just amend the commit that mike (or equivalently, MkDocs) made and remove the offending file. It's just an ordinary Git commit, so all the usual Git subcommands should work fine.

Siroccomeister commented 9 months ago

First I wanted to thank you for your response. It encouraged me to keep digging and looking for a solution. And I am not a real developer, more a geek trying to learn in “low-code” mode.

I managed to do the following : .. I fixed the creation of the sitemap.xml.gz ; there’s an mkdocs plugin that prevents this and which I added .. so I have the feeling I am getting very close :

I have my main branch and my gh-pages branch I can deploy and serve with mike when I check locally - the localhost/800 works well the version selector is shown on the page

When I go on my Gitlab Project online (origin) :

I also see 2 branches My main branch is where I do the development My gh-pages is the branch where the versioned folders get created

But for some reason - the main “Gitlab Page” where the html sits does not show the version selector. I also have the feeling that my 2 branches are completely independent. Each of them is writing to a public folder - but I have the feeling the public folder of my main is not able to access the public folder of gh-pages.

So if you were nice enough to read all the above, I have a basic question : .. is there a need to “merge” the 2 branches, so that the versioned content is brought back to the main branch public folder? .. somehow there’s something I am not getting.

By the way I paid attention to site_url etc… it all seems well set-up.

I hope it somehow makes sense and sparks an idea from your side. I think there’s some ignorance on my side that prevents me to fix this somehow. Great if you have an advice and in any case I wish you a fantastic week-end ahead.

And thanks again for your quick response below. Kind regards

On 26 Sep 2023, at 18:51, Jim Porter @.***> wrote:

Have you tried this with MkDocs (e.g. mkdocs gh-deploy), and without mike? I think this is a bug in MkDocs itself.

Of course, it wouldn't be hard for you to work around if you wanted something right away: just amend the commit that mike (or equivalently, MkDocs) made and remove the offending file. It's just an ordinary Git commit, so all the usual Git subcommands should work fine.

— Reply to this email directly, view it on GitHub https://github.com/jimporter/mike/issues/174#issuecomment-1735927427, or unsubscribe https://github.com/notifications/unsubscribe-auth/BA35J4T7RBX7LFVUM7S73NLX4MBY5ANCNFSM6AAAAAA5HXLF7Y. You are receiving this because you authored the thread.

jimporter commented 9 months ago

Sorry, I can't really help much further than this, since I'm not very familiar with how Gitlab expects users to deploy pages (though I know it's different from Github). Issue #25 has some tips/ideas for how to do this that you could try though.