搭建Mercurial(hg)的Repository(HTTP方式)
来源:互联网 发布:淘宝悬浮导航菜单 编辑:程序博客网 时间:2024/05/16 19:13
之前一直在使用Mercurial,但还没有亲自搭建过通过HTTP访问的Mercurial Reposities。
今天练习了一回,把过程记录下来备查。(非常简单)
============================================================
前提
Mecurial已经安装完成,并且所有hg repository都在目录/home/twer/hg-repo之下,
比如/home/twer/hg-repo/myproject是我自己的项目repository.
--安装apache2
1. 'sudo apt-get install apache2'
2. when visit http://[IP-of-the-box], then 'It works' shows up.
--Expose hg repository by apache2
1. download hgwebdir.cgi to /var/www
2. 'chmod u+x /var/www/hgwebdir.cgi'
3. 'chown -R www-data:www-data /var/www'
4. 在/var/www目录下创建文件:hgweb.config,内容如下:
[collections]
/home/twer/hg-repo = /home/twer/hg-repo
5. 编辑文件 /apache2/sites-enabled/000-default
在<Directory /var/www>之前加入一行 ScriptAlias /hg "/var/www/hgwebdir.cgi"
6. 重启apache(使用命令: sudo /etc/init.d/apache2 restart)
-- 此时,你可以通过 http://[IP-of-the-box]/hg查看所有的repository。
=============================================
-- 使用Basic Auth才能访问Repository
1. 生成密码文件. 用户名为jez
run command 'htpasswd -c /home/twer/hg-repo/password.properties jez
在提示符后输入你的密码。
2. 编辑文件 /etc/apache2/sites-enable/000-default,在<Directory /var/www> section之后加入下面的section(这两个节点是并列的)
<Location /hg>
AuthType Basic
AuthName "Mercurial repositories"
AuthUserFile /home/twer/hg-repo/password.properties
Require valid-user
</Location>
3. 重启apache2 'sudo /etc/init.d/apache2 restart'
4. 当访问 http://[IP-of-the-box]/hg时,会提示输入用户名和密码。
=============================================
--使用用户名和密码才能进行push
1. 配置hg,使所有人都可以push
在linux用户www-data的home目录中建立文件.hgrc,其内容如下
[web]
allow_push = *
push_ssl = false
2. 让apache2对hg repository有写权限
sudo chown -R www-data:www-data /home/twer/hg-repo
3. 需要用户名和密码才能push
将文件/etc/apache2/sites-enable/000-default中的如下片段
<Location /hg>
AuthType Basic
AuthName "Mercurial repositories"
AuthUserFile /home/twer/hg-repo/password.properties
Require valid-user
</Location>
改为
<Location /hg>
AuthType Basic
AuthName "Mercurial repositories"
AuthUserFile /home/twer/hg-repo/password.properties
<LimitExcept GET>
Require valid-user
</LimitExcept>
</Location>
4. 重启apache2 'sudo /etc/init.d/apache2 restart'
完毕。使用命令 ‘hg clone http://[IP-of-the-box]/hg/myproject’试一下吧。
- 搭建Mercurial(hg)的Repository(HTTP方式)
- 搭建HG(Mercurial SCM)服务器
- 突击Mercurial SCM(HG)12---解决repository is unrelated的问题
- 突击Mercurial SCM(HG)
- 突击Mercurial SCM(HG)5---Ubuntu下apache+mod_wsgi搭建hg server
- 突击Mercurial SCM(HG)8---hg server 用户认证
- Mercurial 学习笔记(hg 命令)
- 突击Mercurial SCM(HG)4---Merge
- 突击Mercurial SCM(HG)9---hgignore
- 用hg server 来发布Mercurial repository
- 突击Mercurial SCM(HG)11---自搭Server后push遇到的问题
- 突击Mercurial SCM(HG)2---当前状态
- 突击Mercurial SCM(HG)3---撤销操作
- 突击Mercurial SCM(HG)6---图形化工具TortoiseHg
- 突击Mercurial SCM(HG)10---配置管理一个新项目
- 突击Mercurial SCM(HG)13---回退到指定版本
- Mercurial(hg)
- 突击Mercurial SCM(HG)7---not trusting file /opt/tortoisehg/.hg/hgrc
- 在gridview使用HyperLinkField传递多个参数
- c#数据结构学习——单链表
- 以任务为中心的管理
- SDL入门学习一.装载和退出
- freemarker学习笔记
- 搭建Mercurial(hg)的Repository(HTTP方式)
- 复旦大学中文语料库的一些统计信息
- android 模拟器的使用(Android模拟器介绍及创建)
- IIS问题调试小结
- NET面试题 – 组件开发人员 & XML开发人员
- 心中的小屋
- 产生随机字符串
- Struts2 访问request、session和application对象
- 《世界因你不同》——无处不在的白板