Annoying Password Prompts in Mercurial

If you maintain your own mercurial repository, you may run into the situation where it’s always prompting for username/password for every action against the server. There are a number of ways you can set up your configuration to get around this, however many of them would leave your password as plain text in one of the configuration files. Here’s how to set this up for our server so it’s stored securely.

You need to add some configuration settings to the mercurial.ini file. For windows users, this is located at C:UsersusernameMercurial.ini
Add mercurial_keyring= to the [extension] section and example.prefix / example.username to the [auth] section

[extensions]
mercurial_keyring=

[auth]
example.prefix = http://somehgurl/
example.username =

You will be prompted for your password the next time you pull or pull, but after that it will be saved. You’ll also want to make sure you don’t have the username/password combo stored in any of your synchronization paths. If you do tortoise will complain and ask you to remove it before it’ll take any action.