views:

77

answers:

2

My Mercurial server requires https authentication for pulls. How can I cache my authentication information on the client without exposing a plain-text password on disk?

I'm looking for something like http://stackoverflow.com/questions/2799460/using-sudo-with-mercurial-and-ssh-authentication but for HTTPS.

+3  A: 

have you explored Mercurial keyring?

It supports HTTPS and comes bundled with the latest version of TortoiseHg. If you don't have TortoiseHg, you can install it like any other extension as well (although I recommend TortoiseHg if you're a Windows user).

dls
@dls, This doesn't seem to work well under Windows. The code uses pwd and other unix-specific commands. Apparently there is a cross-platform way of doing this with client-side certificates. Any ideas?
Gili
The TortoiseHg version of Hg and keyring should be fine on Windows. Here's what the keyring docs say: "If you are on Windows, we recommend you use TortoiseHg. THG ships with Windows specific keyring backends, without which the mercurial-keyring extension cannot function properly on Windows. The mercurial-keyring extension itself is shipped with TortoiseHg since version 0.10."
dls
A: 

You can put an [auth] section in your ~.hgrc:

[auth]
foo.prefix = hg.intevation.org/mercurial
foo.username = foo
foo.password = bar
foo.schemes = http https

Or you can always use a URL with authentication info in it, which is as valid in mercurial as it is in your web browser's URL bar:

http://user:[email protected]/path/to/repo/

which you'd put in your repo's .hg/hgrc file's [path] section.

Ry4an
The question explicitly states I don't want to expose a plain-text password on disk. Try again :)
Gili