开发者

Mercurial web user authorization

We installed Mercurial on the server which we use to synchronize developer's local repositories. We use stand alone mercurial web server (hg serve), what we want is to grant access to the web server only to the authorized users, right now it is accessible to all.

Is there any way to configure authorization for Mercurial stand alone web server?

In the configuration file (hgrc) there is a section called [auth] where a list of users can be defined, but it seems it is used for something else,开发者_开发技巧 not for web server.


hg serve allows you to set up authorization rules in [auth], but doesn't handle authentication on its own. It should be provided by a web server.

You have at least these two options for authentication handling:

  1. Configure the hgweb script with Apache, lighttpd, or another web server of your choice.
  2. Put hg serve behind nginx.

Edit. Here's an excerpt from my nginx config file (requests auth for both read and write):

location / {
    auth_basic            "hg-server";
    auth_basic_user_file  /path/to/htpasswd/file;
    proxy_pass            http://127.0.0.1:8000;
    proxy_set_header      REMOTE_USER $remote_user;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜