gitemacsmagitemacsclient

emacsclient: unable to auto-detect email address (got '<my-user-name>@<my-machine-name>.(none)


I cannot commit while using magit in emacsclient, and when I expand the error, I see:

Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got '<my-user-name>@<my-machine-name>.(none)')

N.B. I can commit normally when not using emacsclient (i.e. opening emacs directly from terminal.) My global git configs are set properly and I can commit from anywhere else without any problem. The problem arises when I try to commit using magit inside of emacsclient.

Versions

emacs: GNU Emacs 28.2

doomemacs: Doom core v3.0.0-pre

OS: Ubuntu 22.04

Windowing System: X11


Solution

  • The difference between emacs and emacsclient is that the former creates a process owned by the current user, while the latter requires a server (daemon), which could be started by either current user or system/root user.

    Since you mention that not using emacsclient works fine, then I suspect the emacs server is being run by a user other than the current user, most likely root if you only have one user.