Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mercurial keyring support #34

Closed
kbrownlees opened this issue May 10, 2013 · 5 comments
Closed

Mercurial keyring support #34

kbrownlees opened this issue May 10, 2013 · 5 comments

Comments

@kbrownlees
Copy link

Would be nice to support the mercurial keyring extension so you don't have to specify passwords in plain text.

Biggest issue I have found so far is because interactive is 'off' it will not ask you for a password (just blows up with a repository error). It works once the password is stored in the keyring (ie if you checkout the repo in hg beforehand).

@felipec
Copy link
Owner

felipec commented May 11, 2013

It is supported, I just tried and it works out-of-the-box.

You can also try with something like this in your .hgrc:

[auth]
bb.prefix = https://bitbucket.org/foo/
bb.username = foo
bb.password = foo_passwd

@kbrownlees
Copy link
Author

Are we both talking about https://pypi.python.org/pypi/mercurial_keyring (support for KWallet, Gnome Keyring, OSX and Windows keyrings)? Doesn't look like your code is doing a extensions.loadall(myui) so no extra extensions get loaded by default?

Adding

try:
    extensions.load(myui, 'mercurial_keyring', None)
except ImportError:
    pass

Gets me to the point of mercurial.error.Abort: mercurial_keyring: http authorization required but program used in non-interactive mode
Which is the point where it works if I go and checkout that repo somewhere else using raw hg. Works perfectly first time if we turn interactive mode back on - not sure if this may cause other problems though.

@felipec
Copy link
Owner

felipec commented May 13, 2013

All extensions get eventually loaded. You first push once with mercurial, and then then the rest of the time you can push in git. I tested it, it works fine.

If there's a good reason we could turn on interactivity, or use git's keyring support. But I think for now the support is good enough.

@kbrownlees
Copy link
Author

I will accept once you have a repository it works, I was testing by trying to create a fresh repository. It seems like it doesn't get enabled before we get the point where the clone gets performed? Can you provide an example of creating a fresh repository from a https source with authentication?

ie:

kbrownle@kbrownle-u-kubuntu:~/test $ git clone hg::https://example.com/testengine
Cloning into 'testengine'...
ERROR: Repository error: http authorization required
kbrownle@kbrownle-u-kubuntu:~/test $ git init testengine
Initialised empty Git repository in /home/kbrownle/test/testengine/.git/
kbrownle@kbrownle-u-kubuntu:~/test $ cd testengine/
kbrownle@kbrownle-u-kubuntu:~/test/testengine $ () git remote add origin hg::https://example.com/testengine
kbrownle@kbrownle-u-kubuntu:~/test/testengine $ () git pull
ERROR: Repository error: http authorization required
kbrownle@kbrownle-u-kubuntu:~/test/testengine $ ()

@felipec
Copy link
Owner

felipec commented May 13, 2013

I tried to write up the steps and I found exactly what you mean. So I pushed this fix 9a40fe2. Should work now.

@felipec felipec closed this as completed May 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants