[英]`git branch` output empty without `sudo` on macOS
I am having an issue where the output of git branch
is empty without sudo
.我遇到的问题是
git branch
的 output 没有sudo
为空。 This applies to any git repo (at least all that I have tested), including new ones.这适用于任何git 存储库(至少是我测试过的所有存储库),包括新存储库。 I have tested this in
zsh
, bash3
and bash5
, both with the bundled version of git
and the Homebrew version.我已经在
zsh
、 bash3
和bash5
中对此进行了测试,两者都使用了git
的捆绑版本和 Homebrew 版本。 Interestingly, git checkout
autocomplete (using git plugin of oh-my-zsh) still works as expected, as well as git branch --show-current
.有趣的是,
git checkout
自动完成(使用 oh-my-zsh 的 git 插件)仍然按预期工作,以及git branch --show-current
。
I suspect a UNIX permission problem, but I cannot find any file or directory in .git/
that does not have -r--r--r--
permissions or higher, or that are not owned by current user.我怀疑 UNIX 权限问题,但我在
.git/
中找不到任何没有-r--r--r--
权限或更高权限或不属于当前用户的文件或目录。
The problem was a bad .gitconfig
.问题是一个糟糕的
.gitconfig
。 I had the pager set to LESSCHARSET="UFT-8 less -RF
. -F
causes the pager to terminate when it hits EOF
and less
does not keep output after termination, causing the apparent empty output.我将寻呼机设置为
LESSCHARSET="UFT-8 less -RF
。 -F
导致寻呼机在遇到EOF
时终止,并且less
在终止后不会保留 output,从而导致明显的空 output。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.