Mercurial、TortoiseHg、密钥环以及使用两个远程存储库且忘记了两个用户名和密码
我正在使用 TortoiseHg Workbench 64bit 2.1.4,尽管这可能是 Mercurial 的问题。操作系统是Windows 7(64位)。
我有两个项目,我将它们推送到两个不同的位置(一个是 bitbucket,另一个是私有位置)。他们使用不同的用户名和密码,我通过 HTTPS 推送。
我已在 Mercurial.ini 中设置了密钥环:
[extensions]
mercurial_keyring=
在两个 .hg/hgrc 文件中,我已设置具有各自值的路径:
[paths]
default = https://userX@domainX/XXX
如果我只在一个存储库上工作,则每次连接时都会记住密码。但是,当我在项目之间切换时,我必须重新输入密码。就好像它只会记住一个密码。
下面是带有 --debug 选项的示例日志(在“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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 Windows 机器上尝试过,可以重现,但没有修复。看起来密钥环扩展确实只存储一个密码,当您存储另一个密码时它会被替换。如果您转到 Windows 的凭据管理器,您可以看到这种情况发生。
Mercurial 密钥环扩展使用的 Python 密钥环库中存在一个现有错误报告:
https://bitbucket.org/kang/python-keyring-lib/issue/47/winvaultkeyring-only-ever-returns-last
看起来其中一位开发人员昨天才回复了这个问题,所以也许他正在努力修复。
编辑:根据错误报告,此问题现已修复,并且根据 Lee Atkinson 的说法,它现在也可以在 TortoiseHg 中使用。
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.