如何让 hg 在 cygwin / windows 上提示输入我的 HTTP 身份验证用户名/密码?

发布于 2024-09-07 18:35:42 字数 836 浏览 4 评论 0原文

在家里,这非常有效。我现在在另一台计算机上(使用 cygwin)并且 hg Push 不会提示输入用户名/密码:

user@localhost /cygdrive/d/repos/upthescala/viewprotect
$ hg push https://viewprotect.googlecode.com/hg/
pushing to https://viewprotect.googlecode.com/hg/
searching for changes
abort: http authorization required

以下是我的 ~/.hgrc 的内容:

[http_proxy]
host=someproxy:8080

[ui]
username = My Name <myemail>

提前感谢您的任何建议!

注意:这似乎是一个 cygwin 问题。当我从 Windows 提示符 (cmd.exe) 尝试时,它按预期工作:

D:\repos\upthescala\viewprotect>hg push https://viewprotect.googlecode.com/hg/
pushing to https://viewprotect.googlecode.com/hg/
searching for changes
http authorization required
realm: Google Code Mercurial Repository
user: myemailaddress
password: *********

remote: Success.

-- 莱斯

At home, this works perfectly. I'm on another computer now (using cygwin) and hg push will not prompt for a username / password:

user@localhost /cygdrive/d/repos/upthescala/viewprotect
$ hg push https://viewprotect.googlecode.com/hg/
pushing to https://viewprotect.googlecode.com/hg/
searching for changes
abort: http authorization required

Here are the contents of my ~/.hgrc:

[http_proxy]
host=someproxy:8080

[ui]
username = My Name <myemail>

Thanks in advance for any advice!

Note: this seems to be a cygwin problem. When I try from the Windows prompt (cmd.exe), it works as expected:

D:\repos\upthescala\viewprotect>hg push https://viewprotect.googlecode.com/hg/
pushing to https://viewprotect.googlecode.com/hg/
searching for changes
http authorization required
realm: Google Code Mercurial Repository
user: myemailaddress
password: *********

remote: Success.

--
LES

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

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

发布评论

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

评论(3

白云不回头 2024-09-14 18:35:42

这可能是由于使用与 Windows 控制台子系统绑定的 Mercurial 版本造成的。与 Tortoise 一起发布的二进制文件就属于这一类。如果是这种情况,mercurial 期望使用控制台子系统提示输入凭据,但在从 Cygwin shell 运行时找不到它。就我而言,除了修复颜色输出之外,安装和使用 Mercurial 的 Cygwin 版本也解决了该问题。要检查您正在使用哪个版本,请运行“which hg”(但您可能已经知道了)。

This could be caused by using a version of Mercurial that's tied to the Windows console subsystem. The binary distributed with Tortoise falls into this category. If this is the case, mercurial is expecting to use the console subsystem to prompt for credentials, but it does not find it when run from the Cygwin shell. In my case, installing and using the Cygwin version of mercurial fixed the problem, in addition to fixing color output. To check which version you're using, run 'which hg' (but you probably already knew that).

执手闯天涯 2024-09-14 18:35:42

添加到安德鲁的评论:

安装并使用 Mercurial 的 Cygwin 版本解决了该问题,

这也解决了我的问题,但它导致了另一个问题,我花了一些时间才弄清楚。使用 Cygwin 版本的 hg 时,在运行 hg status 时,在 TortoiseHG 下克隆的所有文件都显示为已修改,但在运行 hg diff 时,它们中的任何一个都没有显示任何差异

问题是权限不匹配。在每个存储库中运行 chmod 644 .* -R 解决了这个问题。

To add to Andrew's comment:

installing and using the Cygwin version of mercurial fixed the problem,

This also fixed the problem for me, but it caused another problem which took me some time to figure out. When using the Cygwin version of hg, all files that had been cloned under TortoiseHG showed up as modified when I ran hg status, but no differences were shown for any of them when I ran hg diff.

The problem was that the permissions didn't match. Running chmod 644 .* -R in each repo resolved this problem.

同尘 2024-09-14 18:35:42

由于它是 HTTP,因此您始终可以将用户名和密码放在 URL 中。这适用于任何使用 http auth 的网站和任何浏览器。

hg push https://myemailaddress:*********@viewprotect.googlecode.com/hg/

或者,较新的 Mercurial 版本有一个可供您使用的 auth 部分

顺便说一句,这是一个糟糕的密码。你应该想出比八星更好的东西。

Since it's HTTP you can always put the username and password right in the URL. That works on any website using http auth and in any browser.

hg push https://myemailaddress:*********@viewprotect.googlecode.com/hg/

Alternately, newer Mercurial versions have an auth section you can use.

BTW, that's a terrible password. You should come up with something better than eight stars.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文