Hello everyone.
I’m new to GrapheneOS, and I’m currently trying to do something very specific: clone a git repo located on an external storage device into Termux using the “git clone” command.
To do this, I tested with two devices:
- one where it works, with a “regular” Android version (Realme GT Master Edition)
- the other with GrapheneOS (Pixel 9 Pro XL)
Both have the same Termux version: 0.118.3
I’m using external storage formatted in exFAT, accessible from both file explorers.
I’m also using the same permissions for Termux.
Here’s the process I followed to make it work on the Android phone (based on the Termux wiki: https://wiki.termux.com/wiki/Internal_and_external_storage):
That is:
- allow Termux in Settings > App > Special permissions > All files access
- enable OTG on my phone
- run “termux-setup-storage” in Termux
That gives me, in $HOME/storage, the folder “external-1”, which directly points to the external storage.
I can also access it with (note the path from the root):
cd /storage/XXXX-XXXX/Android/data/com.termux/files/
where XXXX-XXXX is the UUID of the external storage.
Then I just need to run:
git clone storage/external-1/path/to/the/gitrepo
I got the error:
fatal: detected dubious ownership in repository at '/storage/XXXX-XXXX/path/to/the/gitrepo'
I simply did what git suggested:
git config --global --add safe.directory /storage/XXXX-XXXX/path/to/the/gitrepo
And then the git clone command worked!
That’s the normal process to make it work.
Now, let’s see what doesn’t work on GrapheneOS. I am using Termux with the owner Profile.
I plug in my USB drive (no need to enable OTG), it’s detected in the file explorer.
I think there are two possible issues:
First issue: with termux-setup-storage, I never managed to get the folder
$HOME/storage/external-1
The other folders appear fine, but external-1 never shows up.
Second issue:
I can’t access anything with the path /storage/XXXX-XXXX/
But I can find it in /mnt/media_rw/XXXX-XXXX/
I can go inside, add files, modify them, do cp -r to $HOME... Perfect.
But, when I tried :
git clone /mnt/media_rw/XXXX-XXXX/path/to/the/gitrepo
Error:
fatal: detected dubious ownership in repository at '/storage/XXXX-XXXX/path/to/the/gitrepo'
I did what git suggested, like on the other device:
git config --global --add safe.directory /mnt/media_rw/XXXX-XXXX/path/to/the/gitrepo
Then I try git clone again...
And the error persists.
I even tried:
git config --global --add safe.directory '*'
Or other globs, nothing works: same error, same attempt, but not the same behavior.
Also, the command termux-usb -l gives me: “dev/bus/usb/XXX/XXX”. That’s the same result as on the other phone, which means the external storage is indeed “detected”.
Finally, when I’m in /mnt/media_rw/XXXX-XXXX/, I can’t run “git init” in a subfolder. I don’t really understand why, since I can create and delete files there, but that can maybe help to add some context to this error.
I’ve tried enabling on GrapheneOS:
- USB debugging
- USB exploit: ON
- checking developer options for “compatibility changes” for Termux: found nothing.
So, that’s everything I’ve tried : maybe I’m missing something obvious, but right now I can’t figure it out.
What am I missing?
Thanks in advance for any help