Store password in TortoiseHg

MercurialTortoisehgGoogle Code

Mercurial Problem Overview


Is there a way to configure TortoiseHg to store my password?

I have a project hosted on Google Code that I access using TortoiseHg. Whenever I want to push changes to Google Code TortoiseHg prompts me for a username and password. Google Code requires me to use an auto-generated password, and it gets quite repetitive to look it up every time.

Mercurial Solutions


Solution 1 - Mercurial

Both existing answers suggest storing your username and password unencrypted in plain-text, which is a bit of a no-no.

You should use the Keyring extension instead, as it has been specifically designed for securely saving authentication passwords. It already comes bundled with TortoiseHg, so all you have to do is activate it by writing the following in your mercurial.ini file:

[extensions]
mercurial_keyring=

You will also have to associate your username with the push url by editing your repository-specific .hg\hgrc file like in the example below:

[paths]
default = https://<your_username>@bitbucket.org/tortoisehg/thg

For more details on associating your username with the url, see the Repository Configuration (SMTP) section of the Keyring extension page.

Solution 2 - Mercurial

Three steps, watch screenshot. Note: This stores your password in plaintext.

enter image description here

Solution 3 - Mercurial

Security warning

Although this answer is accepted as of 2017-09-15, it is not a recommended solution. You should never store your passwords in plain text. Use the mercurial_keyring extension instead. See another answer here.


You can change your push URL to https://username:[email protected]/repo.

This is explained in [Google Code's][2] and [Mercurial's][3] FAQs.

EDIT: Mercurial FAQ explains another way to do it:

With Mercurial 1.3 you can also add an auth section to your hgrc file:

[auth]
example.prefix = https://hg.example.net/
example.username = foo
example.password = bar

[2]: http://code.google.com/p/support/wiki/MercurialFAQ "Google Code - Mercurial FAQ" [3]: https://www.mercurial-scm.org/wiki/FAQ#FAQ.2BAC8-CommonProblems.How_can_I_store_my_HTTP_login_once_and_for_all_.3F "Mercurial - How can I store my HTTP login once and for all ?"

Solution 4 - Mercurial

If you want to configure it via TortoiseHg, Repository Setting dialog is available. After opening the dialog, please switch to 'Sync' tab. You can add a path with HTTPS auth information.

http://tortoisehg.bitbucket.io/manual/2.9/settings.html#module-web.settings

Solution 5 - Mercurial

Simply modify the hgrc file in the .hg directory of your local repository so it looks like this:

[paths]
default = https://name:[email protected]/hg/

where name is your Google Code login without the gmail/googlemail bit e.g. 'fredb' (not [email protected]), password is the Google-generated password, and yourproj is the name of your GC project. So something like:

default = https://fred:[email protected]/hg/

Solution 6 - Mercurial

This works for me using SSH. I know the password it's in text plain, but this is not a problem in this project. You have to change myUser and MyOPas for your credentials and the path to: TortoisePlink.exe. Edit the mercurial.ini

[reviewboard]
password = myPass
[ui]
username = myUser
ssh = "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -l myUser -pw  myPass

Solution 7 - Mercurial

If you want to store the password in mercurial.ini and it doesn't work anymore after you upgrade to TortoiseHg 4.9 or higher a possible solution is to add the port to the prefix:

[auth]
tax.prefix = http://server:8080
tax.username = cerveser
tax.password = mypassword

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsourcenouveauView Question on Stackoverflow
Solution 1 - MercurialVlad IliescuView Answer on Stackoverflow
Solution 2 - MercurialbruhaView Answer on Stackoverflow
Solution 3 - MercurialNicolásView Answer on Stackoverflow
Solution 4 - MercurialkuyView Answer on Stackoverflow
Solution 5 - Mercurialuser2100815View Answer on Stackoverflow
Solution 6 - MercurialMarcel FernandezView Answer on Stackoverflow
Solution 7 - MercurialCerveserView Answer on Stackoverflow