-1

I've just installed Mercurial on my OSX Mountain Lion Max (10.8) and on my first commit I'm getting the error:

abort: no username supplied (see "hg help config")

I've seen a load of answers which suggest I need to create or copy a file form a certain location and paste it into another location and add my username and email to the document.

If that is the right thing to do:

  • Where is the file I need to copy (or what is the file called that I need to create)
  • Where do I put that file
  • Do I just need to add the following two lines to the file?

    [ui]
    username = Your Name <your@email.com>
    

Thanks for your help.

theDuncs
  • 4,649
  • 4
  • 39
  • 63
  • Another question which is the same as this but doesn't give me enough information to fix the problem: http://stackoverflow.com/questions/2329023/mercurial-error-abort-no-username-supplied – theDuncs Sep 11 '12 at 15:37

1 Answers1

8

That file is named .hgrc and it is located in your home directory. If you just append those lines to ~/.hgrc and everything should be fine.

An extremely detailed overview of the Mercurial configuration file is located here.

Another less convient way is to pass -u your@email.com on the command line.

Chris Mansley
  • 782
  • 5
  • 12
  • Thanks Chris. Which directory is the home directory? – theDuncs Sep 11 '12 at 15:52
  • If you open up a terminal, it is the default directory. You can also get to your home directory by `cd ~` – Chris Mansley Sep 11 '12 at 16:05
  • OK. Home directory found (thanks). But there's no .hgrc file in there. I just installed (successfully I think) Mercurial. Is there a way of seeing hidden files? – theDuncs Sep 11 '12 at 16:12
  • 1
    That file is not created by default. Use `echo -e '[ui]\nusername = Name ' > .hgrc` will create the file – Chris Mansley Sep 11 '12 at 16:22
  • Chris! I've upvoted your answer for the -u tipoff - thanks so much. But I'm still no closer to locating or creating the hgrc file. The echo command didn't help - still no file anywhere on my machine. You're probably sick of helping me out, but if you know any reason why I can't find the hgrc file after running that echo, let me know. Thanks again. – theDuncs Sep 12 '12 at 07:46
  • The file has most likely been created, but it is a hidden file. Try `ls -a` at the command line to see it. – Chris Mansley Sep 13 '12 at 21:21