Mercurial:“远程:需要 ssl”即使推送到 HTTPS 存储库时也是如此
我的 Apache 和 hgwebdir.cgi 通过 HTTPS(带有自签名证书)运行良好,我可以通过浏览器查看存储库并在本地克隆它。我不知道它是否有任何效果,但我正在重写 URL 以使它们更漂亮:
$ cat .htaccess
Options +ExecCGI
RewriteEngine On
RewriteBase /public
RewriteRule ^$ hgwebdir.cgi [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) hgwebdir.cgi/$1 [QSA,L]
但是,当我尝试运行 hg Push 将更改发回时,我得到:
$ hg push
pushing to https://<repository>
searching for changes
http authorization required
realm: Mercurial
user: virtualwolf
password:
remote: ssl required
Apache is set to redirect all HTTP 到 HTTPS 上的请求。远程服务器运行 CentOS,带有 Apache 2.2.3 和 Mercurial 1.3.1(均通过 yum 安装)。
我已经对这个问题进行了大量搜索,最接近的答案是 this 但它指的是 NGINX 而不是 Apache。
谢谢!
I have Apache and hgwebdir.cgi running fine via HTTPS (with a self-signed certificate), I can view the repositories via a browser and clone it locally. I don't know if it'd have any effect, but I'm rewriting the URLs to make them prettier:
$ cat .htaccess
Options +ExecCGI
RewriteEngine On
RewriteBase /public
RewriteRule ^$ hgwebdir.cgi [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) hgwebdir.cgi/$1 [QSA,L]
However, when I try to run hg push to send the changes back, I get this:
$ hg push
pushing to https://<repository>
searching for changes
http authorization required
realm: Mercurial
user: virtualwolf
password:
remote: ssl required
Apache is set to redirect all requests that are on HTTP to HTTPS. The remote server is running CentOS, with Apache 2.2.3 and Mercurial 1.3.1 (both installed via yum
).
I've done a bunch of searching on this problem, the closest I've come to an answer is this but it's referring to NGINX not Apache.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过像这样运行 hg 服务器来解决此问题(无推送 ssl):
You can resolve this problem by running hg server like this (no push ssl):
将此行添加到您想要推送的中央存储库,
不用说,这是相当不安全的,但如果您工作时在一个受到良好保护的 LAN 上,并且有一个良好的防火墙,并且您信任 LAN 上的每个人,那么这是相当不错的。
Add this lines to your central repository where you want to push
Needless to say, this is rather unsafe, but if you’re on a nice protected LAN at work and there’s a good firewall and you trust everybody on your LAN, this is reasonably OK.
事实证明,问题与此处描述的相同。这与 Mercurial 没有直接关系,但对 Apache 来说却很奇怪。
我必须复制
SSLEngine On
和关联的SSLProtocol
、SSLCipherSuite
、SSLCertificateFile
和SSLCertificateKeyFile
code> 指令从我单独的“启用 SSL”Apache 配置文件到我的 Mercurial 虚拟主机文件,尽管其他一切都通过 HTTPS 正常工作。So it turns out the problem was the same as described here. It wasn't anything directly to do with Mercurial, but was oddness on Apache's end.
I had to copy the
SSLEngine On
and associatedSSLProtocol
,SSLCipherSuite
,SSLCertificateFile
, andSSLCertificateKeyFile
directives from my separate "Enable SSL" Apache configuration file to my Mercurial virtual host file, even though everything else was working quite happily via HTTPS.