6

7

SOLUTION

The issue I had was getting my local Mercurial repository to seamlessly push to my remote Kiln repository. It took some fiddling with the configuration files, but now it works great. I'm posting my two configuration files for reference in the future.

My user configuration file (handles ALL repositories):

~/.hgrc contents:
# Mercurial configuration file.
[auth]
kiln.prefix = https://MyKilnSite.kilnhg.com
kiln.username = FirstName LastName
kiln.password = MyPassword123
[ui]
username = FirstName LastName <MyEmailName@MyHost.com>

My repository configuration file (one per repository):

hgrc contents:
[paths]
default = https://MyKilnSite.kilnhg.com/Repo/Repositories/Group/MyRepositoryName
default-push = https://MyKilnSite.kilnhg.com/Repo/Repositories/Group/MyRepositoryName

With this configuration, I can simply issue "hg push" at the command line and it will handle the push without any additional prompts or required parameters. When this works, you can also use the Push command from MacMercurial's Action menu to do the same.

Note: I'm aware that my Kiln password is stored in a plain text file on in my user directory on my desktop computer. This isn't an issue for me -- it's not like I use this password for banking or email or anything else. If you need tighter security, read Ben's answer below for assistance on setting up a more secure way of locking down your authentication settings.

My original posts are listed below. Thanks Benjamin and and FogCreek!

---> Kelsey McClanahan


ORIGINAL POST

I want to use MacMercurial, a GUI Mercurial client for Mac OS X, to PUSH to my Kiln repository.

Everything works fine locally with MacMercurial, and I can do a push from the command line client. The problem is when I do the push from MacMercurial, it doesn't open a password box -- and instead displays the following transcript message:

abort: http authorization required

I believe the solution is to properly configure the [auth] section in the repository hgrc file.

I've tried dozens of different entries in the repository hgrc file, and after consuming several HOURS tying to figure this out, have been unsuccessful. I've also spent considerable time searching this knowledge exchange, and haven't seen an answer either.

I installed the Mercurial client package from the Mercurial web site this morning. As previously stated, all commands work great from the command line. So I know it's installed properly. Everything (I've tried) also works for MacMercurial -- except for the push.

Here's an example of what is currently in my hgrc file:

[auth]
kiln.prefix = https://MySite.kilnhg.com/Repo/Repositories/Group/MyReposName
kiln.username = FirstName LastName
kiln.password = MyPassword
kiln.schemes = http https
[paths]
default = https://FirstName LastName@MySite.kilnhg.com/Repo/Repositories/Group/MyReposName
default-push = https://FirstName LastName@MySite.kilnhg.com/Repo/Repositories/Group/MyReposName

I've tried many different entries and formats in [auth], and haven't been able to figure this out. Does someone have an example for how [auth] should look on a Mac Client?

Thanks, ---> Kelsey McClanahan


UPDATED INFO (POST #2)

After more work, I don't think the problem is with MacMercurial, but instead pushing to Kiln from Mac OS 10.6.2 using an [auth] section. Even from the command line, I still have to always enter my user name and password, no matter what I do in [auth].

Here's what my current [auth] section looks like now:

[auth]
kiln.prefix = https://MySite.kilnhg.com
kiln.username = FirstName LastName
kiln.password = MyPassword123

I've tried the above [auth] in both the repository hgrc and the user ~/.hgrc. It doesn't recognize it for Kiln in either place.

Maybe I'm missing something simple here? Do I have to define "kiln" in the "kiln.xxxxxx" lines someplace?

Maybe I'm expecting something to work in a way it isn't intended -- shouldn't I be able to just type in "hg push" from the command line when [auth] is properly configured and not have to enter a username and password?

Thanks to all help assist. I'd really like to use Kiln in conjunction with FogBugz. Actually, it is working -- I just don't want to type in a username and password each time I do a PUSH to Kiln.

My environment: Mercurial 1.4.3 on Mac OS 10.6.2 -- also using MacMercurial 1.5 as a GUI client.

Cheers! ---> Kelsey


UPDATED INFO 2 (POST #3)

As requested, by Benjamin -- here is the result from "hg --debug push" from the command line:

$ hg --debug push
using https://MySite.kilnhg.com/Repo/Repositories/Group/MyReposName
http auth: user FirstName LastName, password not set
sending between command
http authorization required
realm: kiln
user: FirstName LastName
password:                        {password manually entered here}
http auth: user FirstName LastName, password **********
pushing to https://FirstName LastName@MySite.kilnhg.com/Repo/Repositories/Group/MyReposName
sending capabilities command
http auth: user FirstName LastName, password **********
capabilities: unbundle=HG10GZ,HG10BZ,HG10UN branchmap lookup changegroupsubset
sending heads command
http auth: user FirstName LastName, password **********
searching for changes
common changesets up to 86b7dc2bc93e
no changes found
$

Yep, looks like it doesn't recognize my [auth] section. So, I must be doing something wrong. I even went back and made sure I spelled "password" correctly.

I have an hgrc file configured with [auth] and [path] sections. It seems to pick up the [path] info no problem. I have an ~/.hgrc file configured with just a [ui] section as follows:

~./hgrc file contents:
[ui]
username = FirstName LastName <MyEmail@HostName.com>

As noted, I've tried placing [auth] in both hgrc and ~./hgrc with no success. (Not in both files at the same time.)

Cheers! ---> Kelsey McClanahan

flag
NOTE: I am running MacMercurial 1.5 with Mercurial 1.4.3 on Mac OS X 10.6.2. – Kelsey McClanahan Feb 15 2010 at 19:44
You do not need to specify what kiln is; Mercurial just has you enter an arbitrary prefix so that you can have multiple auths for multiple sites. It doesn't even have to read kiln; it could read sources or similar and it should still work. It also should work on Mac. While Kiln development happens on Windows, I write all of my hobby software on Mac OS X 10.6.2 with Mercurial 1.4.3, and that works. We'll help you figure out what's not working right, but rest assured that this should work, and in some configurations does. – Benjamin Pollack Feb 15 2010 at 20:35

1 Answer

5

Whether you run on Mac or Windows, our kilnauth extension can provide a better alternative than using [auth] a lot of the time. You'll avoid storing your password in a plain-text file, but still be able to avoid typing your password. Instructions for installing and using the extension are available by clicking on Resources -> Kiln Client and Tools in Kiln. (In fact, all Kiln extensions work fine on Mac OS X. We simply do not currently distribute custom tools or installers for that platform.)

If you want to use the [auth] section, there are a few things to be aware of:

First, make sure that you're running Mercurial 1.4 or later. Mercurial 1.3.1 and earlier do not honor the [auth] section.

Second, you can actually put the [auth] section in your global ~/.hgrc/Mercurial.ini file, in which case your credentials will work for all repositories you use from Kiln.

Third, make sure you have the following lines in your ~/.hgrc file:

[auth]
kiln.prefix = https://yoursite.kilnhg.com
kiln.username = Your name or email address in FogBugz/Kiln
kiln.password = your FogBugz/Kiln password

For example, my [auth] section reads as follows:

[auth]
bqb.prefix = https://bqb.kilnhg.com
bqb.username = Benjamin Pollack
bqb.password = nicetrybutnottoday

You notably do not need the kiln.schemes line, since it defaults to https, which is the only protocol Kiln uses. I've also trimmed off the prefix simply to be your entire Kiln On Demand account, meaning that the same prefix will work for multiple repositories.

You will also need to make sure that you do not list your username in the default push/pull URL. If you do, that will override your [auth] section, and you'll still get prompted for the password. If your [auth] section doesn't appear to be working, take a look at the .hg/hgrc file in the repository and make sure that it looks like this:

[paths]
default = https://your.kilnhg.com/Repo/Some/Repo/Here

with no username in front of the domain.


Update: After talking with Kelsey for a bit, we realized the problem was that specifying the username explicitly in the push URL prevents Mercurial from using the [auth] section. I've updated my answer to cover that possibility.

link|flag
Thanks for a reply. Still not working, but I appreciate the quick response! I am running MacMercurial 1.5 I made the changes as suggested, including removing [auth] from hgrc and moving it to ~/.hgrc. I still receive the same error message when doing a push from MacMercurial. I don't think the [auth] is recognized or correct, as if I type "hg push" from the command line, it still asks me for a user name and password. BTW, the user name is pre-filled in with my user name, and always has been for all pushes from the command line. I think it takes it from the [ui] section of ~/.hgrc – Kelsey McClanahan Feb 15 2010 at 19:06
Mac attempts; still not working. -- I tried moving [auth] back to the repository hgrc, but I still yield the same results from the command line and MacMercurial. It just doesn't recognize my username/password with Kiln. I always have to manually type it in from the command line when doing a push to my Kiln repository. – Kelsey McClanahan Feb 15 2010 at 20:13
I added my hg --debug push info to my question. Many thanks for helping me with this. Yes, I agree -- this isn't Kiln related. I'm not configuring something successfully. – Kelsey McClanahan Feb 15 2010 at 20:51
After re-reading your edited answer -- I notice that your "personal" example [auth] section is slightly different than the example above. What I notice is that the bqb.password line doesn't start with kiln. Is this my problem, or a type on your end? – Kelsey McClanahan Feb 15 2010 at 21:03
Sent other requested info via email to the FogBugz Case # you opened. Thanks Benjamin! – Kelsey McClanahan Feb 15 2010 at 21:23
show 2 more comments

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.