On Windows 10, after staging a file in magit and attempting to commit it I get this error message instead

empty ident name (for <(null)>) not allowed

The error message occurs because magit can not find the user.name and user.email git configuration settings. These can be set by magit: how to set default username?

The problem is when this is set globally. Git for Windows will put this in ~/.gitconfig but the default location for your ~ as described in Where can I find my .emacs file for Emacs running on Windows? will be in AppData/..

You can see that it can't find the global config file by M-x magit-command config --list but the same command run from Git for Windows git config --list displays the correct user.name and user.email.

I fixed this by setting the HOME variable to %USERPFOFILE%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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