obsidian-git
obsidian-git copied to clipboard
[Bug]: Mobile version not syncing
Describe the bug
On mobile version (android) it doesn't detect latest commits in git.
It shows that it fetched latest, and it's up to date. But it doesn't really sync at all.
Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)
There is conflict in sync that says
CheckoutConflictError: Your local changes to the following files would be overwritten by checkout: .obsidian/community-plugins.json, .obsidian/core-community-plugins.json, .obsidian/core-plugins.json
Steps to reproduce
Android doesn't sync latest data from git
Expected Behavior
No response
Addition context
No response
Operating system
Android
Installation Method
None
Plugin version
2.20.5
Please describe what you are doing. Did you pull or a backup. Can you commit these files?
I can't pull It is not a backup. It can push, but not pull
Because some commit you are trying to merge into your local branch has changed these files, you have to commit them for git to merge them properly. That's how git works.
no. but, I tried removing folder, following instructions you provided, to make new obsidian vault, install git plugin, insert my github username, and token. and then clone repo. which when I do, it clones everything as it should. But later, after that, if I make changes to notes on my PC, and push (and I see on website it is pushed and newer), then on mobile, it fetches, and says it's up-to-date. Even when trying to exit few times, reboot phone, same thing. It's like, it thinks, it pulled latest, and says it's up-to-date.
Please open the source control view to see if you have those files changed, if so you have to first commit them as I already said.
Yes, changed, commited and uploaded. It sync on PC obsidian, but doesn't pull on android obsidian. From android obsidian it can push only.
As a workaround I always end up with using git from termux.
I've simliar issues - obsidian-git is often even not able to perform a merge local changes when is behind & same time ahead remote (even when they're no conficts; yes I do have Pull changes before push enabled) :(
Using git command line I just go with git pull, confirm merge title, and voilà
As a workaround I always end up with using git from termux.
I've simliar issues - obsidian-git is often even not able to perform a merge local changes when is behind & same time ahead remote (even when they're no conficts; yes I do have
Pull changes before pushenabled) :( Using git command line I just go withgit pull, confirm merge title, and voilà
Yea, I ended up using termux to sync in background as obsidian sync is not good.
Can termux be added as a mode to the plugin? "Use external git" or something, the JS-based one is terribly slow, doesn't work over SSH and makes using obsidian on mobile really unfriendly.
edit: termux exposes an intent for running commands, am decently sure it should be possible to use that.
I'm also having this problem where the plugin says its working and gives me all thumbs up on a pull or push, but doesn't update; the same repo synced the repo and its respective Obsidian Git plugin to complete success and buttery smooth syncing across Win 10, Win 11, and 2 different Kubuntu machines.
I was amazed the plugin auto-synced to my phone anyway, so I'm not too put out. I'll use that Termux workaround for now.
you can run this every hour via cronie in termux
0 * * * * /path/to/this/command <- this is a cron entry for "every hour"
cd /absolute/vault/dir
[ -z "$(find . -mmin -5)" ] && {
[ -z "$(find . -mmin -70)" ] || {
git add .
git commit -m "vault backup"
git push
}
}
it checks if there are files updated in the last hour (70 min), but not in the last 5 minutes (to keep it from doing the push while editing), then pushes
regardless, i still insist on adding termux as an external git handler to obsidian-git
I used this way. I'm using termux-job-scheduler , as there doesn't need to be a termux session active to perform cron jobs.
yup, job scheduling is a good solution as well, and my script will work with it
@Linuxiness
$ termux-job-scheduler -s ~/obsidian_notes.sh --persisted true --period-ms 900000 --job-id 1
`Cannot execute file: /data/data/com.termux/files/home/obsidian_notes.sh`
obsidian_notes.sh
#!/data/data/com.termux/files/usr/bin/bash
cd /storage/emulated/0/Documents/Notes
git pull --rebase
git add --all
git commit -m "$(date) : Samsung"
git push origin main
Termux job scheduler doesn't seem to work for me. Using cron for now.
@bearoxo is it executable?
chmod +x /data/data/com.termux/files/home/obsidian_notes.sh?
@mwoz123 yesss.. that made it work. Thanks
I think I have the same issue, where the android client notifies of "pull", "fetch", then "everything is up-to-date" even when it clearly isn't, remote has newer commits.... The source control view shows lists no changes, but If I do an 'empty' commit, it will revert everything on remote. Is the termux-job our current solution?
It might be a placebo effect but I spot that synchronization works a little bit better if Source control view is not used on android.
@Vinzent03 is it possible that something in Source control view is doing some additional work that's delaying the sync?