开发者

section of .hgrc

开发者 https://www.devze.com 2023-01-28 15:34 出处:网络
I installed Mercurial correctly on the local network开发者_JAVA技巧 and now I have hgusers and when someone tries to \"push\" he is asked for password, if he enters the correct one the password is acc

I installed Mercurial correctly on the local network开发者_JAVA技巧 and now I have hgusers and when someone tries to "push" he is asked for password, if he enters the correct one the password is accepted.

The question is how can I enter the username and password once on each user's .hgrc file? I tried the following but it's not working:

[auth]
localhost.prefix = http://192.168.0.1/hg/
localhost.username = frodo
localhost.password = ok123

I'm getting:

searching for changes
abort: authorization failed

Please help. Thanks.


Here is why it did not work and how it should be configured:

You can either specify 'schemes' option or skip it. 'Schemes' option defaults to 'https'. Thus, if you don't include scheme into 'prefix' option and don't explicitly specify 'schemes' option, you will have this:

# you specify:
[auth]
repo.prefix = server/repo_path
repo.username = username
repo.password = password

# you get:
[auth]
repo.prefix = server/repo_path
repo.username = username
repo.password = password
repo.schemes = https

Resulting config does not match http://server/repo_path, and authentication does not work.

I recommend to always specify scheme either in prefix or in 'schemes' configuration option for disambiguation.

And it is explained in the docs, but you have to read it very carefully to get it.


It really looks like you've got the correct syntax. Two potential problems:

(a) Perhaps you have the wrong value for the prefix. Should you actually have https rather than http?

(b) Are you sure that the username and passwords are correct on the remote machine?

Can you ssh into the server with the username and password?

Additionally, I have a long answer to a similar question here

What worked for me

[ui]
username=Chris McCauley <chris.mccauley@mydomain.com>

[auth]
repo.prefix = https://server/repo_path
repo.username = username
repo.password = password

Chris


Make sure you're using a relatively recent version of mercurial. I don't think the [auth] section existed before 1.6.

As a fallback you can always put username and password right into HTTP URLs (works with any HTTP site):

http://frodo:ok123@192.168.0.1/hg/

but if you can get it working [auth] is the cleaner route.

0

精彩评论

暂无评论...
验证码 换一张
取 消