Hi all, I have made a simple git hook and a GitHub wiki repository with two branches, “master” and “obsidian”. The hook processes merges changes from “obsidian” to “master”, process links in .md files, commits these to “master” and pushes “master”.
This seems to work with a toy wiki:
I am interested in comments and edge cases and how to solve them. Pull requests welcome!
I have recently learned that GitHub Pages allow only 10 minutes in build time, which is less than one quarter of what Vercel allows (45 mins) per deployment.
But here we don’t really deploy a web app where we need to build up the site as if from scratch with every single new deployment, right?
Do I understand correctly that this is just a plain static version of your vault that you can keep adding to without limits (well, GH can limit repository sizes on paper but rarely do they enforce it, right)?
If it is what I think it is, then it’s fantastic and I’m eager to try it, once I’m near a desktop computer.
Hi, The hook is still a bit rough, I am adding edge cases to the regex.
Most of the stuff happens on the local machine anyway. From the point of view of GitHub, there should be little difference. Yes, it is meant to be a “read only” version that gets pushed, not because it couldnt be used as any other github wiki, but It would confuse the script in its current form.
The regex replacements don’t seem to work. (As a non-coder, I cannot fathom also whether only the changes pushed to the remote will be sporting the changed links or they will be changed locally as well.)
As a Wiki needs activated on Pages, where you need to set the source for deployment, I seem to think that these will still count toward a normal deployment, meaning the 10 minute build limits will be enforced? Because that’s not enough.
Hi, I have been trying to adapt this to my real github wiki over the last 24h, but I ran into problems that I think are due to how git merges in some cases.
Ill get back here when I have a solution.
The last line should be git checkout obsidian -- ., which discards the changes in the local working copy after the changes were sent to the remote to main.
But then git merge should come after the regex changes – which for some reason are not performant…
Also, the deployments are done for the Wiki as it was a real live site just like the one handled by Vercel (where I can put up graphs and other goodies with this plugin), which Vercel has 45 minute limits for each site build (enough for roughly 8-9000 files with 0,5-1 attachment on avarage) on the free tier. So…
Had a quick look at the Vercel plugin which looks mature at a first glance.
Possibly a better solution overall, especially as I am also likely not to hit the roof in the free tier. Meanwhile, thanks for the comment on the script. Ill do some more experimenting to see if I can make it work.
I encountered a problem that I am not sure how to solve robustly at the moment.
[[file name|link text]] in obsidian should be substituted for [[link text|file-name]]. Turns out that whitespace is handled differently in some merge strategies and I ended up with [[link-text|file-name]].
Perhaps this can be solved with a new git merge strategy, I will make another small example to illustrate the problem.
Hi all, I have now used the obsidian_git_experiment hook to maintain an obsidian wiki on my computer that is also mirrored to Github for the last seven months or so.
I haven’t had problems for some time now, so I thought id post this here.
It now works by juggling three branches. Someone knowledgeable of Git would most likely be able to optimize.
What does not work is the reverse conversion since I never use the Github interface myself. This should not be hard to implement though.
There might be a problem with [[link|text]] links inside tables. Otherwise I had no problems.
If there is interest, I would like to turn this into a community project led by someone with more time than myself.