I have a very strange problem that I cannot work out. Emacs opens if I run some git commands such as git log, git branch, git show. Some git commands behave normally and do not open emacs, such as git status, git commit, git add. I recently wrote a python script using Fire, which also opens emacs when run.

When emacs opens, the only available buffers are scratch and messages. Emacs opens in the way you would expect from simply typing $ emacs. If I run $ git log > log.txt, I see a normal git log output in log.txt, once I have closed emacs of course.

I have no weird bash aliases that could be responsible and my .emacs is stock. Emacs version 25.2.1 on Ubuntu 18.04.

Any help will be much appreciated.

  • Do env | grep emacs to see if you have any environment variables that specify emacs as an editor/pager/what have you ( as @db48x points out in his comment/answer, PAGER is one suspect but there may be others). For git, you might also want to check git config -l, although any settings there are not going to affect other programs.
    – NickD
    Aug 12, 2022 at 17:15

1 Answer 1


That sounds like a git problem rather than an Emacs problem. Perhaps you have set the PAGER variable to something involving Emacs? Or maybe you have some git aliases in your ~/.gitconfig file that are going awry?

  • or EDITOR is set to emacs?
    – nega
    Aug 18, 2022 at 5:56
  • Possibly, though he said that git log and git show open emacs, but they don’t let you edit anything.
    – db48x
    Aug 18, 2022 at 11:30
  • 1
    I had PAGER set to emacs. Setting PAGER back to less fixes the issue. Sep 5, 2022 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.