2

I am having an issue where the output of git branch is empty without sudo. This applies to any git repo (at least all that I have tested), including new ones. I have tested this in zsh, bash3 and bash5, both with the bundled version of git and the Homebrew version. Interestingly, git checkout autocomplete (using git plugin of oh-my-zsh) still works as expected, as well as 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.

oguz ismail
  • 39,105
  • 12
  • 41
  • 62
choffa
  • 51
  • 4

1 Answers1

2

The problem was a bad .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.

choffa
  • 51
  • 4
  • 1
    Add the `-X` option to your `less` command option set, so as to avoid using the init/deinit sequences; or switch to a Terminal emulator that doesn't use the Alternate Screen. See https://superuser.com/questions/134598/how-can-you-turn-off-alternate-screen-in-osxs-terminal-app (not the answer, just the question and its links). – torek Mar 30 '21 at 19:00