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

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?

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>

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>

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)

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

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

put file .hgrc in $HOME or home/user

Related

Mercurial HG 'pretxncommit.whitespace hook exited with status 1' but no hook specified

the title of this request says it all pretty much. I have no hooks defined in my .hgrc file, but I am getting this rollback message on running hg commit:
transaction abort!
rollback completed
abort: pretxncommit.whitespace hook exited with status 1
my hgrc file looks like this:
[paths]
default = 'the_address'
[ui]
username = 'my name and email address'
verbose = True
[extensions]
mq =
[diff]
git = 1
unified = 8
Just in case it is important. I am using Mercurial on Ubuntu 12.04 and I am trying to combine it with using a XAMPP installation (Apache friends) in the /opt/ directory, so I always have to run sudo before doing a commit.
Looking through SO and searching on the web, I found that this error is due to a hook with regard to trailing whitespace in the code (Compare this part of Mercurial: The definitive guide and also this SO entry on hooks). Strangely enough, I haven't defined this hook anywhere, so I also don't know how to remove it.
Any help in sorting this out would be appreciated. Thanks guys.
============================================================================
EDIT: Incorporating what smooth reggae suggested, I put a hgrc file in the home folder and the root folder and I adjusted the hgrc file in etc/mercurial just to find out what the deal with this problem is.
I am not sure, how much more information debug = True should give, but I didn't get particularly much. At the beginning of the commit message, I see the following now:
could not import hgext.hgext.mq (No module named hgext.mq): trying hgext.mq
could not import hgext.hgext.transplant (No module named hgext.transplant): trying hgext.transplant
So, this means, it can't find these two files, but why?
Thanks again for all your help.
EDIT2: Please note that the first EDIT is an unrelated issue and can be ignored for this particular question.
can you add debug = True under [ui] in your .hgrc file? That will give you some more output, which might offer some insight into the location of this hook

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

I'm not sure why but since today I have the problem with pushing my source to repo.
I got abort: no username supplied (see "hg help config")
The thing is that I have [ui] section in hgrc:
[ui]
username = My username
verbose = true
Where's the problem then?
Try doing:
hg --debug showconfig
that shows you all the configuration settings Mercurial is finding and where it's finding them. Since it looks like you're on windows one possibility is BOMs (byte order markers) at the front of your hgrc file. Nodepad likes to incorrectly put them in there.
In a pinch you can always do hg --config ui.username=Whatever_you_want commit, but that's a terrible long term solutions.
Lastly, one expects that error on commit, but you said you're getting it on push. I can't imagine how that could happen.
Either put a hgrc in the .hg directory in your repo or put a hgrc file in your home dir (then it covers all your projects) In the file you should write..
[ui]
username = Your Name <your#mail>

How do I set my username in Mercurial?

When running Mercurial I get this error:
t3#des:gem5$ hg qnew my_p.diff
abort: no username supplied (see "hg help config")
the hg help config says:
The configuration files use a simple ini-file format. A configuration file
consists of sections, led by a "[section]" header and followed by "name =
value" entries:
[ui]
username = Firstname Lastname <firstname.lastname#example.net>
verbose = True
But where is that ini file?
hg help config
These files do not exist by default and you will have to create the
appropriate configuration files yourself: global configuration like
the username setting is typically put into
"%USERPROFILE%\mercurial.ini" or "$HOME/.hgrc" and local configuration
is put into the per-repository "/.hg/hgrc" file.
Assuming your on linux, create the .hgrc file in either your home directory or in the repository dir in question,
dirunderhgcontrol/.hg/.hgrc
Add the info(ui, username, verbose...) you stated in your question to the new file and then give it a try.

Problem with loading hggit extension in TortoiseHG

I'm trying to get the hggit extension to work under Windows 7 (64bit) using TortoiseHG (2.1.2). I followed the official setup instructions, i.e. cloning the hg-git repository and adding the "hggit = ..." line to the extensions section in my mercurial.ini file.
However the extension doesn't seem to be loaded. When trying to clone a repository I get the following error :
abort: repository git://... not found!
running
hg help hggit
results in
hg: unknown command 'hggit'
I also don't get any errors at all, no matter what I put in the extensions section of the mercurial.ini file.
Any ideas on what the problem might be ? Are there any log files at all that show me whether there are problems loading the extensions ?
Had the same problem, and in my case I forgot to specify the [extensions] line in the INI file.
Not working:
[ui]
username = My name <my#emailaddress.com>
hgsubversion=D:\Repotools\hg-svn\hgsubversion
hggit=D:\Repotools\hg-git\hggit
Working:
[ui]
username = My name <my#emailaddress.com>
[extensions]
hgsubversion=D:\Repotools\hg-svn\hgsubversion
hggit=D:\Repotools\hg-git\hggit
When you run the command hg help hggit it will report if the directory path is incorrect.
You should include what you have after hggit =
It should be pointing to the hggit subdirectory in the directory you cloned the repository into.
e.g. hggit=C:\hg-extensions\hg-git\hggit

create hgrc file to work on all paths on a machine, and for several repos

I want to create a hgrc file to set the username and password for all paths on some machine, e.g no matter in which directory I am in, hg clone some_path will always work without prompting for a username and a password (this is for an auto-deploy script). Also, it should work for several repos, not just one.
I followed the instructions and created a file: /etc/mercurial/hgrc.d/deploy.rc
it's contents:
[auth]
default.prefix= http://myrepo
default.username = myuname
default.password = pwd
But when I do
hg clone some_path I get abort: error: Connection refused.
What Am i doing wrong?
It should work. You can use hg showconfig to verify that it really is reading the config and that you don't just have a connection problem or something.
What version of hg are you using?
Also, it could be that your .hg/hgrc file is taking precedence over your global config.
Could you get the log of the server you try to connecgt to?
It should be listed there if at least the server address is correct.
And perhaps a hg clone -v something