将密码存储在 TortoiseHg 中

发布于 2024-09-27 07:56:02 字数 291 浏览 8 评论 0 原文

有没有办法配置 TortoiseHg 来存储我的密码?

我有一个托管在 Google 代码 上的项目,我使用 TortoiseHg 访问该项目。每当我想要将更改推送到 Google 代码时,TortoiseHg 都会提示我输入用户名和密码。 Google Code 要求我使用自动生成的密码,而且每次都要重复查找它。

Is there a way to configure TortoiseHg to store my password?

I have a project hosted on Google Code that I access using TortoiseHg. Whenever I want to push changes to Google Code TortoiseHg prompts me for a username and password. Google Code requires me to use an auto-generated password, and it gets quite repetitive to look it up every time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

兔姬 2024-10-04 07:56:02

现有的两个答案都建议将您的用户名和密码未加密存储在纯文本中,这是一个禁忌。

您应该使用 Keyring 扩展,因为它是专门为安全保存身份验证密码而设计的。它已经与 TortoiseHg 捆绑在一起,所以您所要做的就是通过在 mercurial.ini 文件中写入以下内容来激活它:

[extensions]
mercurial_keyring=

您还必须通过编辑存储库特定的 .hg\hgrc 将您的用户名与推送 URL 关联起来文件如下例所示:

[paths]
default = https://<your_username>@bitbucket.org/tortoisehg/thg

有关将用户名与 url 关联的更多详细信息,请参阅 Keyring 扩展页面的 noreferrer">存储库配置 (SMTP) 部分。

Both existing answers suggest storing your username and password unencrypted in plain-text, which is a bit of a no-no.

You should use the Keyring extension instead, as it has been specifically designed for securely saving authentication passwords. It already comes bundled with TortoiseHg, so all you have to do is activate it by writing the following in your mercurial.ini file:

[extensions]
mercurial_keyring=

You will also have to associate your username with the push url by editing your repository-specific .hg\hgrc file like in the example below:

[paths]
default = https://<your_username>@bitbucket.org/tortoisehg/thg

For more details on associating your username with the url, see the Repository Configuration (SMTP) section of the Keyring extension page.

衣神在巴黎 2024-10-04 07:56:02

三步,观看截图
注意:这会以明文形式存储您的密码。

在此处输入图像描述

Three steps, watch screenshot.
Note: This stores your password in plaintext.

enter image description here

○愚か者の日 2024-10-04 07:56:02

安全警告

尽管此答案已于 2017 年 9 月 15 日被接受,但它不是推荐的解决方案。您永远不应该以纯文本形式存储密码。请改用 mercurial_keyring 扩展。请参阅此处的另一个答案


您可以将推送 URL 更改为 https://username:[电子邮件受保护]/repo

Google 代码 和 < a href="https://www.mercurial-scm.org/wiki/FAQ#FAQ.2BAC8-CommonProblems.How_can_I_store_my_HTTP_login_once_and_for_all_.3F" rel="noreferrer" title="Mercurial - 如何一次性存储我的 HTTP 登录信息所有?">Mercurial 的 常见问题解答。

编辑:Mercurial FAQ 解释了另一种方法:

使用 Mercurial 1.3,您还可以将 auth 部分添加到 hgrc 文件中:
<前>[授权]
示例.前缀 = https://hg.example.net/
示例.用户名 = foo
示例.密码 = bar

Security warning

Although this answer is accepted as of 2017-09-15, it is not a recommended solution. You should never store your passwords in plain text. Use the mercurial_keyring extension instead. See another answer here.


You can change your push URL to https://username:[email protected]/repo.

This is explained in Google Code's and Mercurial's FAQs.

EDIT: Mercurial FAQ explains another way to do it:

With Mercurial 1.3 you can also add an auth section to your hgrc file:

[auth]
example.prefix = https://hg.example.net/
example.username = foo
example.password = bar
傾旎 2024-10-04 07:56:02

如果您想通过 TortoiseHg 配置它,可以使用“存储库设置”对话框。
打开对话框后,请切换到“同步”选项卡。
您可以添加包含 HTTPS 身份验证信息的路径。

http://tortoisehg.bitbucket.io/manual/2.9/ settings.html#module-web.settings

If you want to configure it via TortoiseHg, Repository Setting dialog is available.
After opening the dialog, please switch to 'Sync' tab.
You can add a path with HTTPS auth information.

http://tortoisehg.bitbucket.io/manual/2.9/settings.html#module-web.settings

少女的英雄梦 2024-10-04 07:56:02

只需修改本地存储库的 .hg 目录中的 hgrc 文件,使其看起来像这样:

[paths]
default = https://name:[email protected]/hg/

其中 name 是您的 Google 代码登录信息,无需使用gmail/googlemail 位,例如“fredb”(不是[电子邮件受保护]), password 是 Google 生成的密码,yourproj 是您的 GC 项目的名称。所以像这样:

default = https://fred:[email protected]/hg/

Simply modify the hgrc file in the .hg directory of your local repository so it looks like this:

[paths]
default = https://name:[email protected]/hg/

where name is your Google Code login without the gmail/googlemail bit e.g. 'fredb' (not [email protected]), password is the Google-generated password, and yourproj is the name of your GC project. So something like:

default = https://fred:[email protected]/hg/
又爬满兰若 2024-10-04 07:56:02

这对我使用 SSH 有效。我知道密码是纯文本形式的,但这在这个项目中不是问题。
您必须更改 myUser 和 MyOPas 的凭据以及 TortoisePlink.exe 的路径。
编辑 Mercurial.ini

[reviewboard]
password = myPass
[ui]
username = myUser
ssh = "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -l myUser -pw  myPass

This works for me using SSH. I know the password it's in text plain, but this is not a problem in this project.
You have to change myUser and MyOPas for your credentials and the path to: TortoisePlink.exe.
Edit the mercurial.ini

[reviewboard]
password = myPass
[ui]
username = myUser
ssh = "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -l myUser -pw  myPass
无需解释 2024-10-04 07:56:02

如果您想将密码存储在 Mercurial.ini 中,并且在升级到 TortoiseHg 4.9 或更高版本后它不再起作用,可能的解决方案是将端口添加到前缀:

[auth]
tax.prefix = http://server:8080
tax.username = cerveser
tax.password = mypassword

If you want to store the password in mercurial.ini and it doesn't work anymore after you upgrade to TortoiseHg 4.9 or higher a possible solution is to add the port to the prefix:

[auth]
tax.prefix = http://server:8080
tax.username = cerveser
tax.password = mypassword
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文