VirtualWolf
VirtualWolf

Reputation: 723

Mercurial: "remote: ssl required" even when pushing to HTTPS repository

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!

Upvotes: 10

Views: 6557

Answers (3)

Mohamed Dernoun
Mohamed Dernoun

Reputation: 825

Add this lines to your central repository where you want to push

[web]
push_ssl=False
allow_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.

Upvotes: 4

IvanM
IvanM

Reputation: 3053

You can resolve this problem by running hg server like this (no push ssl):

hg serve --config web.push_ssl=No --config "web.allow_push=*"

Upvotes: 14

VirtualWolf
VirtualWolf

Reputation: 723

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 associated SSLProtocol, SSLCipherSuite, SSLCertificateFile, and SSLCertificateKeyFile 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.

Upvotes: 3

Related Questions