Why do I not have a .hgrc file?

3.9k Views Asked by At

I'm trying to insert the mercurial_keyring file with my username and password in the .hgrc file but it doesn't exist in my user directory on windows. I have tortoise hg installed and even checked if it was installed properly on the command prompt yet I still don't have the .hgrc folder.

Can anyone tell me what might be the reason to it?

Thanks

3

There are 3 best solutions below

0
On

The .hgrc files are not created automatically when you install Mercurial or TortoiseHg.
You will need to manually create it at the location you need whether that is within the repository's .hg folder or your own C:\Users\username\ folder.
You will probably need to use the command line to create the file as it's not usually possible to create filenames that start with . in Windows Explorer.

https://www.selenic.com/mercurial/hgrc.5.html

2
On

Because it's %USERPROFILE%\mercurial.ini

Mercurial reads configuration data from several files, if they exist. These files do not exist by default and you will have to create the appropriate configuration files yourself:

Local configuration is put into the per-repository /.hg/hgrc file.

Global configuration like the username setting is typically put into:

%USERPROFILE%\mercurial.ini (on Windows)
0
On

Run the command 'hg config --debug' and it will give full details of the configuration steps. Somewhere near the start you will see something like this:

read config from: C:\Program Files\TortoiseHg\mercurial.ini
read config from: C:\Users\<UserName>\mercurial.ini
read config from: C:\Users\<UserName>\.hgrc

So those are the files it's looking for...