I setup a free account a short while ago at bitbucket with the intention of creating a version control repository for Hg.
So far this has worked out well.
Although every time I communicated with the back end repo I’d have to enter my credentials.
I realized if I added my user name to the URL, I’d only receive a password prompt.
If I also added my password in the URL I wouldn’t be prompted for anything.
Obviously I didn’t want to be entering this each time I communicated with my back end repo,
also especially with my password in plain text on the screen.
So I did a little research.
TortoiseHg comes bundled with the keyring extension.
So if your using TortoiseHg you don’t even have to install it.
Just add the following to your mercurial.ini file in your user directory.
You’ll also have to edit your repository specific hgrc file.
If this file doesn’t already exist, create it.
[paths] bitbucket = https://LethalDuck@bitbucket.org/LethalDuck/code-scripts default = https://LethalDuck@bitbucket.org/LethalDuck/code-scripts
You could put your password in the above URL too, but that kind of defeats the purpose of using the keyring.
So you associate your username with the URL you are wanting to communicate with.
Now you can add as many URL’s as you like.
As you can see I’ve just added the same one twice, as an experiment to see how it’s handled.
In Repository Explorer, it’ll look like this…
Now when you select either of the URL’s to push to or pull from,
the keyring will prompt for your password once and store it encrypted.
After that, the stored encrypted password is used
and no more prompt.
Tags: Version Control