Closed zixijian closed 2 years ago
Example:
$ cd ~
$ termux-setup-storage
$ ln -s storage/external-1/nwipe nwipe
$ cd nwipe
~/nwipe $ git config --global --add safe.directory /sdcard/nwipe
~/nwipe $ git add .
~/nwipe $ git diff --cached autogen.sh
diff --git a/autogen.sh b/autogen.sh
old mode 100755
new mode 100644
index da9a805..e2103fe
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-
+114514
# Script to create all the required autoconf files
aclocal
~/nwipe $
Are you using an external sdcard?
git config --global --add safe.directory /storage/emulated/0/tt
is worked.
but git config --global --add safe.directory /sdcard/tt
is not worked.
I also deployed a chroot container on my phone, where the git diff works without adding a safe directory.
Even if the problem can be solved in this way, but there is no corresponding prompt with use git diff, I do not think this is a good solution.
And i am not using an external sdcard。
The path to /storage/emulated/0
can be replaced with ~/storage/shared/
.
The path to /sdcard/
can be replaced with ~/storage/external-1/
.
/sdcard/
will be linked to internal storage if no external sdcard is inserted.
So please use ~/storage/shared/
when without inserting external sdcard .
ls -la ~/tt
lrwxrwxrwx 1 u0_a244 u0_a244 34 Dec 22 2020 tt -> storage/shared/Quark/Download/.t
ls -la tt/
total 1643
drwxrwx--- 8 root everybody 3488 Aug 31 23:28 .git
-rw-rw---- 1 root everybody 18 Aug 25 09:42 .gitignore
-rw-rw---- 1 root everybody 1656 Aug 25 09:42 Guide.md
-rw-rw---- 1 root everybody 11261 Aug 25 09:42 README.md
-rw-rw---- 1 root everybody 9132 Aug 25 09:42 Special.md
-rw-rw---- 1 root everybody 171523 Sep 1 12:15 Wiki.md
-rw-rw---- 1 root everybody 1858 Aug 25 09:42 act.tt
-rw-rw---- 1 root everybody 7229 Aug 25 09:42 ali.tt
drwxrwx--- 2 root everybody 3488 Aug 25 09:42 bot
-rw-rw---- 1 root everybody 924 Aug 25 09:42 colorpad.tt
-rw-rw---- 1 root everybody 832 Aug 25 09:42 config.tt
-rw-rw---- 1 root everybody 13130 Aug 25 09:42 emote.tt
-rw-rw---- 1 root everybody 349 Aug 25 09:42 example.tt
-rw-rw---- 1 root everybody 77181 Aug 25 23:31 goto.tt
-rw-rw---- 1 root everybody 1797 Aug 25 00:16 init.tt
-rw-rw---- 1 root everybody 10520 Aug 25 09:42 newbie.tin
-rw-rw---- 1 root everybody 102 Aug 25 09:42 pku.tt
drwxrwx--- 2 root everybody 3488 Aug 25 09:48 refer
-rw-rw---- 1 root everybody 1319185 Aug 25 09:42 rooms.tt
-rw-rw---- 1 root everybody 1904 Aug 25 09:42 ttm.tt
Termux already has read and write access to this directory, so why set up a safe directory? I don't think that's reasonable.
Just don't store your git repository on /sdcard or other storage directories that are FAT32 (exFAT) or tend to emulate such file system. Such file systems have issues setting correct timestamps as well as Unix file permissions. As result, git is confused and doesn't work properly.
Store your repositories in $HOME of Termux instead. If need file editing using external application, consider using Storage Access Framework features. See the last section of https://wiki.termux.com/wiki/Internal_and_external_storage.
This is not a bug.
Just don't store your git repository on /sdcard or other storage directories that are FAT32 (exFAT) or tend to emulate such file system. Such file systems have issues setting correct timestamps as well as Unix file permissions. As result, git is confused and doesn't work properly.
Store your repositories in $HOME of Termux instead. If need file editing using external application, consider using Storage Access Framework features. See the last section of https://wiki.termux.com/wiki/Internal_and_external_storage.
This is not a bug.
Thank you for your explanation.
I chose to place the git repository in /sdcard really because I needed an external editor. Even if you think it's not a bug, I still have two problem here. 1). my chroot container on my phone,deployed ubuntu 18,There are no exceptions to using git to manager /sdcard repository. 2).git prompts information that doesn't help users solve problems effectively. when we find a problem, all we have to do is solve it.
Problem description
When the git repository exists on the /sdcard using git diff will not recognize the repository, directory copy to termux's own space is normal.
Other git command have similar issue:
If you create a new repository and execute the above command, you can use git diff as normal.
What steps will reproduce the bug?
First authorize the /sdcard permissions, then copy a git repository to the /sdcard, and link this directory to termux,
ln -s /sdcard/tt ~/tt && cd ~/tt
, modify some file,inputgit diff
will not recognize the repository.But,
cp -r /sdcard/tt ~/tt && cd ~/tt
,here usegit diff
will be normal.What is the expected behavior?
Can not see git diff when the repository on the sdcard.
System information
git version 2.37.2
termux-info: