如何使用Mercurial保存用户名和密码? [英] How to save username and password with Mercurial?

查看:110
本文介绍了如何使用Mercurial保存用户名和密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在个人项目中使用了Mercurial,每次我想将某些内容推送到服务器时,我一直在输入用户名和密码.

I used Mercurial in a personal project, and I have been typing my username and password every time I want to push something to the server.

我尝试将以下内容添加到主目录中的.hgrc文件中,但似乎被完全忽略了.

I tried adding the following to the .hgrc file in my home directory, but it seems to be completely ignored.

[ui]
username = MY_USER_NAME
password = MY_PASSWORD

如何正确执行此操作?

推荐答案

您可以在.hgrcMercurial.ini文件中创建一个auth部分,如下所示:

You can make an auth section in your .hgrc or Mercurial.ini file, like so:

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

"bb"部分是一个任意标识符,用于将前缀与用户名和密码进行匹配-便于管理具有不同站点(前缀)的不同用户名/密码组合

The ‘bb’ part is an arbitrary identifier and is used to match prefix with username and password - handy for managing different username/password combos with different sites (prefix)

您还只能指定用户名,然后在按下时只需键入密码即可.

You can also only specify the user name, then you will just have to type your password when you push.

我还建议您查看密钥扩展.由于它将密码存储在系统的钥匙圈中而不是纯文本文件中,因此更加安全.它与Windows上的TortoiseHg捆绑在一起,目前正在讨论将其作为捆绑的扩展程序分发到所有平台上.

I would also recommend to take a look at the keyring extension. Because it stores the password in your system’s key ring instead of a plain text file, it is more secure. It is bundled with TortoiseHg on Windows, and there is currently a discussion about distributing it as a bundled extension on all platforms.

这篇关于如何使用Mercurial保存用户名和密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆