Mercurial, TortoiseHg, keyring and using two remote repos with two usernames and passwords being forgotten

拈花ヽ惹草 提交于 2019-12-22 12:07:50

问题


I am using TortoiseHg Workbench 64bit 2.1.4, though it may be an issue with Mercurial. The OS is Windows 7 (64bit).

I have two projects that I push to two different locations (one is bitbucket, the other is an private one). They use different usernames and passwords, and I push over HTTPS.

I have setup the keyring in my mercurial.ini:

[extensions]
mercurial_keyring=

and in the two .hg/hgrc files, I have setup paths with their respective values:

[paths]
default = https://userX@domainX/XXX

If I only work on one repo, the password is remembered each time I connect. However, when I switch between projects, I have to re-enter the password. It's as if it will only remember one password.

Below is an example log with teh --debug option (the password is prompted after the line saying 'user: userX (fixed in .hg/hgrc)':

% hg --repository xxx push --debug https://userX@domainX/XXX
pushing to https://userX@domainX/XXX
using https://userX@domainX/XXX
http auth: user userX, password not set
sending capabilities command
domainX certificate successfully verified
Keyring URL: https://userX@domainX/XXX
Keyring password found. Url: https://userX@domainX/XXX, user: userX, passwd: ********
domainX certificate successfully verified
Keyring URL: https://userX@domainX/XXX
http authorization required
realm: DEV
user: userX (fixed in .hg/hgrc)
Saving password for userX to keyring
Manually entered password. Url: https://userX@domainX/XXX, user: userX, passwd: ********
domainX certificate successfully verified
sending heads command
Keyring URL: https://userX@domainX/XXX
Cached auth data found. Url: https://userX@domainX/XXX, user: userX, passwd: ********
domainX certificate successfully verified
searching for changes
no changes found
checking for updated bookmarks
sending listkeys command
Keyring URL: https://userX@domainX/XXX
Cached auth data found. Url: https://userX@domainX/XXX, user: userX, passwd: ********
domainX certificate successfully verified

回答1:


I tried on my Windows-machine, and I can reproduce but have no fix. Looks like the keyring extension indeed only stores one password and it gets replaced when you store another. If you go to Windows’s Credential Manager you can see this happening.

There is an existing bug report in the Python keyring library that the Mercurial keyring extension uses:

https://bitbucket.org/kang/python-keyring-lib/issue/47/winvaultkeyring-only-ever-returns-last

Looks like one of the developers replied to it just yesterday, so maybe he is working on a fix.

Edit: According to the bug report this is now fixed, and according to Lee Atkinson it is now also working in TortoiseHg.



来源:https://stackoverflow.com/questions/7806100/mercurial-tortoisehg-keyring-and-using-two-remote-repos-with-two-usernames-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!