Mercurial error: abort no username supplied

Viewed 51849

Problem on WindowsXP (likely will happen on all Win installs), first time using Mercurial. I found the answer in an inobvious place so I'm asking/answering the question myself so others don't have to search like I did.

First time using Mercurial on machine.

Add new repoz:

c:\bla\>hg add

no problem.

Next, commit:

c:\bla\hg commit

error:

abort: no username supplied (see "hg help config")

10 Answers

Solution:

On my Windows install, the Mercurial.ini did not get propagated. It also needs a user email added to it.

Take the default Mercurial.ini file found at in the Mercurial executable install directory (C:\Program Files\Mercurial\Mercurial.ini on my machine) and copy it to your user home dir (C:\Documents and Settings\myName on winXP).

On a Windows 7 install there is no default .ini, you will need to create a new one in C:\Users\myName.

Then edit that .ini file. Find this area. The username needs an email set. It will be blank--add your email name here.

[ui]
; editor used to enter commit logs, etc.  Most text editors will work.
editor = notepad
username = userEmail@domain.example

This fixed the problem for me.

I'm sorry, but why do you call this a problem? Mercurial asks you to see hg help config, and this help text explicitly tells you how to add a username -- I know since I wrote that help text :-)

How should we improve the error message to make this more clear?

However, we've managed to screw this up by making hg help config include help for all config settings. So the nice little example of how to set the username:

[ui]
username = Your Name <your@email.example>

is now lost in the noise (add this to ~/.hgrc, creating the file if necessary). I've opened an issue for this.

This is a problem because in the help file the path to the specified config file does not exist, we have to copy the Mercurial.ini from program files directory to USER directory, maybe this is a problem coming from the installer on windows.

@Kevin Won: you forgot to add the line:

verbose = True
Related