Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial error: abort no username supplied

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 = [email protected]

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?

Edit: Since I wrote this in 2010, 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 <[email protected]>

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


On Windows XP I do not see an ini file. After creating the repository using the command hg init, I added a file with the name hgrc to the folder .hg

With the following content:

[ui]  
editor = notepad  
username = [email protected]

no matter windows or linux, hg looks the "/.hg/hgrc" file for valid configuration. As in "hg help config" says, you only have to add at the end of that file the following lines:

[ui]
username = YOUR NAME <[email protected]>
verbose = true

save and "hg commit -m 'test'"


If you are using TortoiseHg, you can add [UI] settings easily

  1. Right clicking in any folder Explorer to access the TortoiseHg menu.

  2. From the flyout TortoiseHg menu choose Global Settings

  3. From the interface click the Edit File

  4. Add the [UI] settings to the end

[ui]

username = YourName

verbose = true

  1. Save and you are done

Here is what worked like a charm for me on Windows XP:

  1. Go to the folder C:\Program Files\Mercurial\hgrc.d assuming you have installed Mercurial to C:\Program Files\Mercurial\.
  2. You should see a Mercurial.RC file in there.
  3. Copy the file to C:\Documents and Settings\ [USERNAME]\
  4. Rename Mercurial.RC to Mercurial.ini.
  5. Edit the [ui] section like so:

    [ui]

    ; editor used to enter commit logs, etc. Most text editors will work.

    editor = notepad

    verbose = True

    username = [email protected]