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

How to Create a Pinned Cygwin Icon in Windows 7

Pinned Cygwin icon

When you install Cygwin, it creates a shortcut to the Cygwin.bat file that resides in the installation directory.  But if you try to pin it to the Windows 7 taskbar with drag-and-drop, it won’t work.  Here’s how you can do it:

  1. Right-click on the desktop, and in the context menu, select New->Shortcut.
  2. In the dialog box, enter the location of the shortcut item.  If Windows and Cygwin are installed in the default locations, it will be something like:
  3. C:\Windows\System32\cmd.exe /c C:\cygwin\Cygwin.bat

  4. Click “Next”.  Enter “Cygwin” for the shortcut name.  An icon with the C:\ command prompt will appear on your desktop.
  5. Right-click the icon and view Properties.  Click the “Change Icon…” button.  Browse to the Cygwin installation directory and select Cygwin.ico.
  6. Double-click the new desktop shortcut and make sure the Bash shell appears.  Right-click the icon in the taskbar and select and select “Pin this program to the taskbar”.  You’re done!

Alternatively, you could just run cmd.exe, pin it to the taskbar, and edit the properties to run Cygwin.bat while it’s pinned.  But then you would not be able to alter the icon as easily.