Today is a great day ;) i switched my repos from svn to mercurial.
I was still thinking about GIT but there where three key points that made me choose mercurial
Cons: it’s slower than GIT ( but who cares :D )
So after installing mercurial and moving my svn repos with history with hgsvn ( which can also do push to svn )
I started to setup easy access to the repository using nginx. I’ll show you how to setup an SSL http based repository to do PUSH/PULL/CLONE what ever.
Firstly we have to make self signed ssl certificates.
I found on of the easiest tutorials available you can find it here: http://www.akadia.com/services/ssh_test_certificate.html
OK when we have the ssl certificates for our server. Put it somewhere on the server so nginx can access it.
We have to setup a new virtual host for nginx that will only do ssl connections
and have basic auth additionally.
Here’s the example config:
server {
listen 443;
server_name hg.yourserver.com;
ssl on;
ssl_certificate /home/ssl_certs/hg_cert.crt;
ssl_certificate_key /home/ssl_certs/hg_cert.key;
access_log /var/log/nginx/hg.log;
auth_basic "mercurial server";
auth_basic_user_file /etc/nginx/.htpasswd;
location / {
proxy_pass http://127.0.0.1:8001;
#here's where the hg server runs
include /etc/nginx/proxy.conf;
}
}
Few thing to notice.
.htpasswd file has to be in a format <username>:<cryptPassword> if you don’t have apache
installed you can use my password generator for generating crypt password. This username
and password will be used to do pull/push from console and eclipse.
Another important thing is that when you run hg serve you must specify the -a 127.0.0.1 option which is
for the address the mercurial server runs. Hg serve default is to start at all interfaces
so you have this port open outside and your ssl/passwd protection is for nothing…
I run my using hg serve –webdir-conf=/etc/hg/hgweb.conf -d -p 8001 -a 127.0.0.1
The hgweb.conf should be with
push_ssl = false
#since nginx is doing the SSL
allow_push = * #NGINX is doing the auth
style = gitweb
O and one more thing remember that your repo should be accessible to hg serv.
I made a mistake and run hg serve as www-data and my repo was to my home user,
and i had internal server error when trying to do push to server.
So now you can have your repo via http with SSL and nginx authentication.