-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Termux Git, Empty Object File #3385
Comments
In what directory your repository is located? If that's a some path under The file system bug is easily reproduced using Nothing to do with Termux. Note that if you need to make changes in your repo and want to use a GUI editor instead of |
Actually, my path is not in storage but rather it is in the downloads folder
~/storage provides the symlinks to directories on /storage/emulated/0. They
were made for user convenience and do not serve any special purpose for the
Termux application.
|
Thanks for the reply. Actually, my path is in the downloads folder:
And that's the issue. Is there anyway to host my git files in home directory but access them through other apps like obsidian (I think it doesn't support storage volumes)? |
Termux supports SAF document provider, check second link above. If your app supports it, then you can use it. |
Obsidian seems to support SAF. But for some reason I can't select the wanted storage volume. Access to the root directory of shared storage is blocked either and it is possible to select only sub directory (scoped storage takes action). Using Android 13, all permissions are granted to Obsidian app. There is a way to split the git repo and checkout directory which can eliminate the file system issue. Example:
|
You need to select termux home, not shared storage. Both are separate SAF providers. |
Sorry, seem to have missed your earlier comment. OP should contact the dev to add support I guess. Selecting root of shared storage and Downloads directory is not allowed by android 11. https://developer.android.com/about/versions/11/privacy/storage#directory-access |
Your solution seems appropriate. I implemented it in my workflow and currently it is working well. Let's see if it has any problems. |
Thanks for this solution/work-around, been struggling at it for around a week, but this finally solved it. Thank you very much |
@pourmand1376 @Swayam2004 Can you post the full command(s) that you ran to fix this? Do I need to add |
Git dir and work tree should be specified every time. The reason behind a fix/workaround is to place got repository on a file system that works in a way expected by git. No one-time command exist for a permanent fix. |
I've written a simple script to solve this issue. See here. This way you can sync your obsidian on mobile only by typing |
@pourmand1376 Thanks - that blog post was super informative. So you have abandoned the obsidian-git plugin entirely on Android in favor of your solution? Or is there a way to combine your solution with obsidian-git on Android? |
It basically disabled it on android. I use it for other OSes like windows and Linux. |
@pourmand1376 With the However, as per the comment from @sylirre, the bug here seems to be around managing files under |
I haven't encountered this, but I have sometimes encountered empty files inside # Get the list of modified files with .md extension and read them into the array
git diff --name-only --cached --diff-filter=M | grep -E "\.md$" | while read -d $'\n' file
do
# Check if the file is empty
if [ ! -s "$file" ]
then
# Roll back the file to its last commit state
git checkout HEAD -- "$file"
echo "Restored $file to its last commit state"
fi
done |
Please do not revive old resolved issue threads. But if we're here anyway, may as well answer the question. |
Problem description
I have a git client installed in Termux. I sync it daily with my Github repository. However, once in a while I get these two errors:
I can solve them by re-cloning the repo. But I want to know why this happens?
Steps to reproduce the behavior.
Follow this tutorial on here. I think after a week of usage, you would see this error at least once.
I think this is somehow related to termux virtual environment since I get no errors in Windows or Linux.
What is the expected behavior?
There should be no error regarding empty file. It should just work.
What I've tried
I have tried these solutions (none of them worked):
System information
The text was updated successfully, but these errors were encountered: