Mercurial error: abort no username supplied

51,799

Solution 1

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.

Solution 2

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

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

Solution 3

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]

Solution 4

no matter Windows or Linux, hg looks the <repo>/.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'

Solution 5

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 <[email protected]>
    verbose = true
    
  5. Save and you are done

Share:
51,799

Related videos on Youtube

Kevin Won
Author by

Kevin Won

.NET developer / Team Lead Developing Enterprise Integration apps for BigCo   interested in functional techniques &amp; Haskell.

Updated on July 08, 2022

Comments

  • Kevin Won
    Kevin Won almost 2 years

    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")

    • mipadi
      mipadi over 14 years
      How is information about a version control utility not programming-related?
    • Draemon
      Draemon over 13 years
      @mipadi: In the same way that information about using a keyboard isn't programming related.
    • Celeritas
      Celeritas over 11 years
      It's really a black eye for Mecurial that it's been more than two years and this problem still exists.
    • luser droog
      luser droog about 11 years
      Where's the damned file in Cygwin??! ... Oh. If the repo is clone'd or init'ed, there's one in (repo)/.hg
  • Kevin Won
    Kevin Won over 14 years
    I posted this q/a to hopefully help someone in the future from having to waste time with this nugget.
  • Kevin Won
    Kevin Won over 14 years
    (1) the installer doesn't copy the .ini to the user directory, (2) the error text makes perfect sense in a *nix context but not for windows. I think the problem is tha the error msg doesn't make sense in a windows context (at least on xp). Having now installed this on Ubuntu, I can say that the msg is fine for that platform, but stand by my contention that it s not helpful for Windows (xp at least). Thanks for your work on Mercurial and I hope this comment helps make the issue I had clearer.
  • Martin Geisler
    Martin Geisler over 14 years
    Thanks for the explanation -- it's so nice to see when people followup on questions with the solution they found :-) However, the help text for hg help config does include instructions for Windows, i.e., it lists the possible locations of your Mercurial.ini file. One of the locations is C:\Program Files\Mercurial\Mercurial.ini (listed as <install-dir>\Mercurial.ini), so I'm unsure why the settings in that file did not take effect.
  • Nick Fortescue
    Nick Fortescue over 14 years
    The big problem for me (and what brought me to this question) was the fact none of this is mentioned on the quick start page: mercurial.selenic.com/quickstart/#. That page implies that a basic install followed by following the instructions will work, and it doesn't, without reading the help text. At this point you are nervous because you already assume something has gone wrong
  • Martin Geisler
    Martin Geisler over 14 years
    Ah, I see what you mean. This change is new in Mercurial 1.4 and we forgot to update the quickstart guide. Sorry about that!
  • Phil Gan
    Phil Gan about 14 years
    @Martin Geisler: The hg help config text doesn't say what we need to do to solve the problem and it's not particularly clear where the paths are pointing in the "On Windows" section. Where does %USERPROFILE% or %HOME% point? I guess it doesn't help that following installation mercurial.ini doesn't exist anywhere on my system.
  • Martin Geisler
    Martin Geisler about 14 years
    @Phil: as you've probably guessed, I'm no Windows user :-) But I think I would open a Command Prompt and execute echo %USERPROFILE% to see what the value is of the environment variable (I think echo works the same as in Linux, but I'm not 100% sure). But fear not -- we talked about changing this just yesterday on our IRC channel: I expect the next version of Mercurial to prompt you for your username and store it for you in the right Mercurial.ini file.
  • Phil Gan
    Phil Gan about 14 years
    @Martin Geisler: Actually that's not too important - I can have a good guess at what %USERPROFILE% might signify but none of the files listed in the hg help config output exist after running the installer. Previous experience would suggest that missing files mean something somewhere has gone seriously wrong. As it turns out I only needed to make an ini file myself. (And get TortoiseHG and VisualHG)
  • Phil Gan
    Phil Gan about 14 years
    Actually there's no Mercurial.ini file in my install directory either. Adding a file called hgrc in the .hg folder of my repository with the above text allowed me to commit changes.
  • Martin Geisler
    Martin Geisler about 14 years
    I agree that it's confusing that we don't put in a template configuration file -- we are asked about this on IRC quite a lot by both Linux, Windows, and Mac users.
  • jpf
    jpf over 13 years
    No Mercurial.ini file in my install directory either (Win 7 64-bit). I created Mercurial.ini on C:\Users\Abbas and copy-pasted Kevin's [ui] snippet and it worked like a charm. Tried Phil's solution and it worked too.
  • Wes
    Wes about 13 years
    Thanks for the question and answer. It would have taken me ages to figure that out. Ah, the hardships of developing on Windows...
  • Andrew Cowenhoven
    Andrew Cowenhoven over 12 years
    Also works for Windows Server 2008 and the 64 bit Mercurial msi except of course step 3 should be c:\users[username]
  • urig
    urig over 12 years
    Having installed "TortoiseHg 2.2 with Mercurial 2.0 - x86 Windows", the Mercurial.RC file can be found under C:\Program Files\TortoiseHg\hgrc.d
  • Tony Giaccone
    Tony Giaccone over 12 years
    Don't mean to be insulting, so please take this as an attempt to be constructive. There may be an answer in the 1260 lines of text that gets printed out to standard out when I do "hg help config" but I really think that 1260 lines of text is excessive and that a short distinct answer, even if it sends me to the docs would be much much better.
  • Martin Geisler
    Martin Geisler over 12 years
    @TonyGiaccone: Back in 2010 hg help config would only print a screenful of text and I had made sure that setting the username was the main example in that text. Since then we've managed to screw that up by including the help text for all config options in that output :-( I've opened an issue for this: mercurial.selenic.com/bts/issue3348
  • E-rich
    E-rich almost 12 years
    mention of the hgrc in the .hg folder was helpful
  • Sam
    Sam about 11 years
    +1 for your comment regarding the 'noise' I came here rather than trying to hunt through the huge help config output
  • Patrick
    Patrick about 11 years
    I believe the correct link to the issue is this: bz.selenic.com/show_bug.cgi?id=3349
  • int_ua
    int_ua over 10 years
    Where is that config file on Ubuntu?
  • Martin Geisler
    Martin Geisler over 10 years
    @int_ua: You add the username to ~/.hgrc on Ubuntu. The config files are described in the beginning of hg help config.
  • int_ua
    int_ua over 10 years
    Yes, it worked, thanks. The problem was that the help wasn't piped through less so I've seen only the ending and the filename was above the lines limit.
  • James Freitas
    James Freitas over 8 years
    I am using Tortoise Hg and that tip help me as well. Thanks !