strange. its all supported POSIX standards for BSD so that should work on all kinds of systems especially other macs…
the error might be caused by the double quote format.
git add .; git commit -q -m “$(date +”%Y-%m-%d_%H:%M:%S”)”; git push
Try adding an underscore or a dash between it. That’s how it worked for me.
(At least the first time, then Git kept crashing in WSL 2, but that had nothing to do with the commit message, but with Git alleging there to be lock files when there weren’t.)
I wrote this powershell script with similar functionality. gist here: powershell script
You can schedule a windows task, similar like a cron job.
I’ve been using Github as a sync platform for some time now with good results. I adjusted my link format to ‘Absolute path in vault’ which then gives me the added benefit of navigating (view-only) my notes repository using the Android Github app like a personal wiki. I constantly move from laptop to PC to mobile, so I haven’t tried the automation described above.
I adjusted my link format to ‘Absolute path in vault’ which then gives me the added benefit of navigating (view-only) my notes repository using the Android Github app like a personal wiki.
@Erisred would you mind explaining or breaking down this process for a non-developer? i’m not sure what this means
i’m attempting this obsidian -> github sync process now.
was considering using GitJournal to edit my notes on mobile -> sync to GitHub -> sync to Obsidian local files (?)
git pull # ^^^^^^ So if any changes occurred remotely or on another machine # your local machine knows to pull those changes down instead of # having to wait for a local change to run the script
@tallguyjenks would this bit enable the GitJournal sync to Obsidian files process?
i’ve never used git journal,
git pull in that particular part of the script is so, hypothetically, if I’m at work and i make changes to my git repo through github, when i get home, the script will run and pull any changes made to the remote repo to my vault on my computer using git
perfect, thank you!!
@hieu - I’m very much not a developer, myself…
Are you looking for help with Git/Github, or are you familiar with that part of the process? There’s a lot to unpack there, so I’d rather know your level of comfort before I walk through the process.
For the Obsidian part, I go to settings and set the ‘New link format’ to ‘Absolute path in vault’ *Disclaimer - some folks don’t like this as much, because the link format is not as clean as wikilinks. It is a standard link format, though, and works across platforms very well.
Then, using the Github app on Android, I can open the repository and navigate the files. The links work in the app like they do in Obsidian. This is the ‘view-only’ interface I mentioned.
I don’t do much editing on mobile, mostly because it’s messy. I’ve edited straight through the Gihub app, and I have Markor installed - it will also work in a pinch. I could not get Git journal to do what I wanted.
After using some self-written scripts myself I switched to
It handles the sync great, adds sanity checks, adds news files etc. It even runs fine on Windows using the bash shell that comes included in the Git client distribution.
Thanks! This is useful
I am on windows and tried to let the git-sync script run with the windows task-scheduler every X Minutes. But eventhough for a very short pereiod of time a git-bash windows opens the script doesnt run. When I start the script manually (double click, with cmd or git-bash) it pushes and commits correctly.
Has anyone worked out a good solution to automate this process on windows?
Edit: I found my problem. I forgot to include the directory where the script has to run in the task scheduler
But still one question is left: Now a git bash window is opened every X minutes and it syncs my files. But is there a way to let this process run without opening a window of git-bash?
I would also like to know.
@mangosteel @msamedic I think this might help: Setting up Obsidian Git on Windows for the tech uninitiated (with images)
Thank you @argentum, I have tried watching multiple different tutorials on making this work and my first few tries I was trying to combine their methods to no avail. I had given up until my computer crashed today and I lost hours of work on a note that had been replaced entirely with some kind of colored special character (red dots). Luckily, I have ManicTime screenshots so I will be able to transcribe my work.
Let this be a warning to those placing important information in these notes. After that, I decided I needed backups and since version history is so valuable, and since people seemed to be able to get this git backup working with the new plugin, I figured I’d give this one last go.
The link you provided, followed exactly step by step, works like a charm. And it’s clearly explained. Very simple.
I think I will also be setting up a local automatic backup of my vault. Thanks again.
Backups are extremely important! There is also a new
File Recovery feature in case something happens too:
Unfortunately the File Recovery feature was the reason I thought I was safe in the first place. This feature was only able to recover a single save from a few days ago which is of no use to me. I do not think it’s fully functional yet (or at all, in my case).
@mangosteel that doesn’t sound right.
File Recovery creates snapshots of your files every 5 minutes by default (unless you changed the settings). Since this is getting off-topic for this thread, feel free to open a #bug-reports or #get-help thread for this.
When I copied the script from the forum all the quotes had been changed for curly quotes and that was causing it not to work. Maybe that’s the cause?