magit-status sees the repo just fine, and I can even push to Github, or make a branch. I can also commit through the git cli no problem.

However, before I can even write my commit message on magit I get the following error:

 1 git … commit --
hint: Waiting for your editor to close the file...
Waiting for Emacs...
*ERROR*: Not inside Git repository
error: There was a problem with the editor '/usr/bin/emacsclient.emacs --socket-name=/run/user/1000/emacs/server39157'.
Please supply the message using either -m or -F option.

I read (with-editor)Configuring With-Editor on magit's manual, but I don't believe my installation of Emacs is abnormal. I installed it through the usual sudo apt install emacs. Furthermore, both emacsclient and emacsclient.emacs are located on /usr/bin. I tried customizing with-editor-emacsclient-executable to just usr/bin/emacsclient (no .emacs), to no avail.

There's a couple of lines to note in the output of with-editor-debug. For brevity, I've added the entire output to this pastebin.

  server-auth-dir: ~/.emacs.d/server/
    WARNING: not an accessible directory

When I checked, the server sub-directory didn't exist. I tried creating it, but still, no success.

I'd be grateful if someone could give me directions on this. Committing through cli is getting tiresome 😅.

My installation's versions is:

Magit 20221008.1927 [>= 3.3.0-git], Git 2.34.1, Emacs 27.1, gnu/linux


  • Can you open an existing file with emacsclient <somefile>? How about a non-existent file, writing something into it and saving it? If those succeed, then it's probably a magit problem; otherwise it's an emacsclient one.
    – NickD
    Oct 16, 2022 at 4:42
  • @NickD Just tried that. Seems to work just fine, both opening an existing file, and creating/saving another. I did have to start the server from emacs, I'm assuming that's standard procedure. I also tried committing again, but previously starting the server, same thing. Looks like a magit thing still. Oct 16, 2022 at 13:28
  • I found one github issue about this. Does any of this sound familiar to you? github.com/magit/with-editor/issues/69
    – g-gundam
    Oct 16, 2022 at 16:04
  • 1
    @g-gundam Similar symptoms, but my error message doesn't seem external to magit. As suggested in that issue, I searched for the error on the installed packages. Turns out, it's from magit-git.el. In it, one of the four functions that raise the same error is magit-inside-gitdir-p. And sure enough, if I run the commented command git rev-parse --is-inside-git-dir in the working directory, it returns false. I don't know yet what this means, but I'm starting to think there's a bad config somewhere. Oct 16, 2022 at 21:50
  • 1
    Concerning exec-path, emacs can find the git executable no problem. Git is also in PATH, and exec-path is set to it's location. Oct 16, 2022 at 21:53


Your Answer

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

Browse other questions tagged or ask your own question.