用hg server 来发布Mercurial repository
来源:互联网 发布:淘宝风干牛肉干可靠吗? 编辑:程序博客网 时间:2024/06/05 10:56
用hg server 来发布Mercurial repository
用hg server 来发布Mercurial repository
经常使用Mercurial的repo(比如:xen-unstable.hg),本文就如何搭建一个hg repository吧。
首先,需要建立一个repo,【安装mercurial软件包 自不必说的了】
$ hg init (project-directory)
$ cd (project-directory)
$ (add some files)
$ hg add
$ hg commit -m 'Initial commit'
然后,在repo的目录内,运行hg serve即可发布这个repo。(默认情况下使用TCP8000端口)
在另外一台机器上,运行如下hg clone命令即可将repo clone下来。
hg clone http://vt-repo:8000/ my-repo.hg #vt-repo为我的server name
如何支持push? 在server端配置
1. 使用http/web方式push:在server端的repo中修改.hg/hgrc文件。
(或者修改your Web server user's .hgrc file, such as /home/www-data/.hgrc, or a system-wide hgrc file like /etc/mercurial/hgrc)
添加如下配置信息:
[web]
push_ssl = false
allow_push = *
(注意:一定需要保证你的repo目录对运行Web Server的用户具有可读可写的权限。hg push 默认使用https方式,需要ssl认证,allow_push是限制那些用户可以push,这里再内网,对这些权限方面的暂时不做限制。)
2. 使用ssh方式push:修改client端的.hg/hgrc文件制定push的
添加如下内容:
[paths]
default = http://vt-repo:8000/ #这一行是clone下来就有的
default-push = ssh://user@vt-repo/my-repo.hg
(client端hg push之时会让你输入user在vt-repo上ssh登录的密码)
在client端的配置,只需要添加一个用户自己的username即可,在.hg/hgrc文件中添加如下:
[ui]
username = your_name <your_email@xxx.com>
客户端将repo clone下来,然后修改,然后commit,最后push即可。
这里再添加一个我曾用过的一个脚本,它用来做hg serve的。
#!/bin/bash
#
# Startup script for mercurial server.
#
# Change following lines
APP_BIN=/usr/bin/hg
SRC=/home/repo/pub/xen-unstable.hg
SRCNAME="xen-unstable"
# Path to PID file of running mercurial process.
PID_FILE=/home/repo/hg-serve.pid
state=$1
case "$state" in
'start')
echo "Mecurial Server service starting."
(cd ${SRC}; ${APP_BIN} serve --name "${SRCNAME}" -d -p 8000 --pid-file ${PID_FILE})
;;
'stop')
if [ -f "${PID_FILE}" ]; then
PID=`cat "${PID_FILE}"`
if [ "${PID}" -gt 1 ]; then
kill -TERM ${PID}
echo "Stopping the Mercurial service PID=${PID}."
else
echo Bad PID for Mercurial -- \"${PID}\"
fi
else
echo No PID file recorded for mercurial
fi
;;
*)
echo "$0 {start|stop}"
exit 1
;;
esac
- 用hg server 来发布Mercurial repository
- 用Mercurial(Hg)好处多
- 突击Mercurial SCM(HG)8---hg server 用户认证
- Mercurial(hg)
- 搭建Mercurial(hg)的Repository(HTTP方式)
- 用Mercurial(Hg)好处多 - [program](转)
- 突击Mercurial SCM(HG)5---Ubuntu下apache+mod_wsgi搭建hg server
- [wiki]Mercurial hg使用指南
- mercurial hg best pratice
- 关于Mercurial(Hg)
- hg(Mercurial)使用参考
- Mercurial: hg使用
- hg(Mercurial)使用参考
- Mercurial(Hg)基本操作
- Mercurial(Hg)基本操作
- hg(Mercurial)总结
- mercurial hg 使用
- Mercurial(Hg)基本操作
- linux原子操作
- python按时间排序目录下的文件
- PIG LATIN分析报告
- S5PV210(TQ210)学习笔记——按键驱动程序
- Leetcode 第151题 最新题解 Reverse Words in a String
- 用hg server 来发布Mercurial repository
- Linux学习1--Linux在VMware Workstation虚拟机中的超详细安装(RHEL_5.7)
- 将IP以整型的形式存储到数据库中
- shell递归遍历目录
- HLG 1400 汽车比赛
- Yii——图片附件的上传、编辑及删除【同样适用于其它类型附件】
- win7 下的telnet不是内部或外部命令也不是可运行的程序或批处理
- c# winform 实现对postgresql数据库的自动备份还原功能
- QT的定时器事件中遇见的一个误区