Well, using a shared folder to store a git project is a second synchronisation method on a single folder. Git might try to write something but shared folder was syncing it and it caused some issues. Or the other way around, the main idea being that when two systems tries to access the same file (be it the .git folder, it is bound to cause issues ![]()
I have it in /data/data/com.termux/files/home/storage/shared - is that shared in the sense of sync? I thought it was shared between apps on the device?
If that is not it, what other folder to use? …/storage/documents?
Maybe you just have some weird git issues, try to search for your specific error online and try the fixes ?
I’d suggest something like git pull --prune from what I can tell of your error. It may just be a git corrupted thing because some branch got out of sync and it can’t get out of it himself.
I did try things like git pull –prune, but the corruption occured again and again
https://medium.com/@askar.zhakenov/obsidian-git-sync-on-android-with-termux-and-lfs-c5bb05e0f1cc sounded similar to my problems, did that setup (excepts lfs) and testing it now
Moving the .git folder out of the shared android storage into something termux exclusive did indeed work for me (see medium article above)
created an account just to say thanks - easiest set-up and worth the little bit of effort
This is my script that I execute via cron on my tablet (Samsung S6 Lite) and my phone (Xiaomi Redmi Note 11):
cd ~/storage/shared/obsidian;
git add .
git commit -am “synced via tablet on ${date}”
git fetch
git merge origin/main -X theirs -m “merge mit tablet”
git push
The merge command gives priority to what’s already in the main branch. Before I had a lot of unnecessary merge conflicts from differences plugin settings etc. Another possibility would be to put the .obsidian directory into the .gitignore file and configure the settings for each device seperately.
I’ve had problems with renaming filenames from lower case to upper case or vice versa. It’s like git on termux is not case sensitive? It created weird merge conflicts. Now I just avoid changes like that.