Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the username that Mercurial uses for commits?

Tags:

mercurial

When I commit something in Mercurial like this:

hg commit -m "username question" 

I see this output:

No username found, using 'WindowsVistaAdmin@ChunkyMonkey' instead 

ChunkyMonkey is my Windows machine name and obviously WindowsVistaAdmin is the user that I am signed in as on this machine.

How can I set the username to something more respectable, or, at least, more concise?

like image 387
tent Avatar asked Sep 09 '09 20:09

tent


People also ask

How do I change my mercurial username?

You should think of the HGUSER environment variable and the -u option to the hg commit command as ways to override Mercurial's default selection of username. For normal use, the simplest and most robust way to set a username for yourself is by creating a . hgrc file; see below for details.


2 Answers

In your ~/.hgrc (*nix) or mercurial.ini (Windows) file:

[ui] username = First Last <[email protected]> 

(mercurial.ini is in C:\Documents and Settings\[username]\ for XP and lower, C:\Users\[username]\ for Vista and higher. You can also run hgtk userconfig if you have TortoiseHg installed and do it that way.)

like image 153
tghw Avatar answered Oct 25 '22 18:10

tghw


you can specify your username on the command line directly if you want to using --config. eg

hg --config ui.username=frymaster -m "comment here" commit 

in fact, you can override anything in your .hgrc with this command. just look at your .hgrc and note the format:

[section] key=val 

that translates directly to

hg --config section.key=val 
like image 24
frymaster Avatar answered Oct 25 '22 17:10

frymaster