Mercurial: abort: no username supplied (see “hg he

2019-01-30 09:42发布

问题:

I have added repository and at the time of commit I get error as

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

I am not getting Mercurial.ini file on my local as well. Does anyone know how I can resolve this error on Fedora?

回答1:

Either put a hgrc in the .hg directory in your repo or put a .hgrc (hgrc for Windows) file in your home dir (then it covers all your projects) In the file you should write

[ui]
username = Your Name <your@mail>


回答2:

On Windows, these configuration files are read:

- "<repo>\.hg\hgrc"
- "%USERPROFILE%\.hgrc"
- "%USERPROFILE%\Mercurial.ini"
- "%HOME%\.hgrc"
- "%HOME%\Mercurial.ini"
- "C:\Mercurial\Mercurial.ini"
- "HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial"
- "<install-dir>\Mercurial.ini"

On Unix, these files are read:

- "<repo>/.hg/hgrc"
- "$HOME/.hgrc"
- "/etc/mercurial/hgrc"
- "/etc/mercurial/hgrc.d/*.rc"
- "<install-root>/etc/mercurial/hgrc"
- "<install-root>/etc/mercurial/hgrc.d/*.rc"

Include the following in one of these files above:

[ui]
username = Your Name <your@mail>


回答3:

Simple answer - in your .hg folder, create a file named .hgrc in there, add the following content (check hg help config for the exact syntax)

[ui]
username = forename surname <forename.surnamce@email.com>
verbose = True

and save it. Should work now. Note that verbose = True is not required, but I included it since it is listed in the help content

(This is from memory, but hg help config will tell you the correct filename and syntax)



回答4:

run hg config --edit ( tested it in hg 3.1 both on linux debian and windows) it will create (if not exists) and open a file with text:

# example config (see "hg help config" for more info)

[ui]
# name and email, e.g.
# username = Jane Doe <jdoe@example.com>
username = 

[extensions]
# uncomment these lines to enable some popular extensions
# (see "hg help extensions" for more info)
# pager =
# progress =
# color =  

fill "username" field and save the file



回答5:

Make sure that the current user owns the hgrc file or otherwise has correct permissions for it.



回答6:

put file .hgrc in $HOME or home/user