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:
- Use the -u option to supply a username during every commit. Trust me, you don’t want to have to do this.
- Create an hgrc file every time you create a new repository, and put the username there. Again, this would get annoying fast.
- 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@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.