Installing Mercurial on Windows 7: “abort: no username supplied”

Yesterday I installed Mercurial.  I wanted to see what the hype was over Distributed Version Control Systems (DVCS).  I was satisfied with Subversion before, but after you see “Git” and “hg” in forums and blogs enough times, curiosity gets the better of you.

I like TortoiseSVN’s Windows shell integration, but even though there is a TortoiseHg, I’ve read mixed reviews about its stability.  Also, the screenshots make it look unnecessarily complicated.  It turns out I was unjustified in my concerns, since Mercurial’s command line interface is so simple and intuitive, the lack of GUI makes no difference.

If you plan on learning Mercurial yourself, I recommend you read Joel Spolsky’s Hg Init tutorial first.  It’s well-written and interspersed with humor.  If you’re a Windows 7 user, this is almost all you need to get started.  I say “almost” because the first time you commit, you’ll see the error message:

abort: no username supplied (see “hg help config”)

There are three ways you can deal with this issue:

  1. Use the -u option to supply a username during every commit.  Trust me, you don’t want to have to do this.
  2. Create an hgrc file every time you create a new repository, and put the username there.  Again, this would get annoying fast.
  3. Create a Mercurial.ini file in the C:\Users\your_username folder (or whatever your user folder is in Windows).  The file should contain the following text with your first name, last name and email substituted:
[ui]
; editor used to enter  commit logs, etc.  Most text editors will work.
editor = notepad
username = First_name Last_name <email_address@example.com>

It’s too bad the Windows installer for Mercurial can’t handle this on its own, because it creates a negative first impression of the software.  Once you fix the problem, things should work fine and the software is easy and enjoyable to use.

Advertisement

3 thoughts on “Installing Mercurial on Windows 7: “abort: no username supplied”

    1. Glad you found it useful. By the way, I use TortoiseHg all the time now, and it’s great. The screenshots I link to in the article make it look more complicated than it is.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s