Mercurial For Linux是一种轻量级分布式版本控制系统,使用Python语言达成,易于学习和用,扩展性强,其是基于GNU General Public License授权的开源项目。这个工具在国内极少人用,所以中文资料匮乏.只有官方的website上有一些少得可怜的中文资料了.不过大体上来讲,还是最好用的。
1.打造用户hgrepo
其它用户将用这个账户用hg服务器push代码。
useradd hgrepo -d /home/hgrepo # add user hgrepo
passwd hgrepo
2.打造hg代码仓库
假如代码仓库名字为project.hg,则可用如下命令。
cd /home/hgrepo
mkdir project.hg
cd project.hg
hg init # 初始化代码仓库
打造一个测试文件
echo hello, mercurial sample.txt
hg add # add
hg ci # check in
3. 打开http
打开一个端口,让远程用户可以clone仓库中的代码.
在打开端口前请确定文件权限正确。
更改文件权限
chown hgrepo.hgrepo /home/hgrepo/project.hg -R
chmod og+rw /home/hgrepo/project.hg -R
打开端口
cd /home/hgrepo/project.hg -R
hg serve -p 8002
可将上面两行加入/etc/rc.local如此就能在开机的时候自动运行了。
4.用hg
完成步骤3将来,大家就能用了。
clone到当地
比如你的服务器的名字为test.
hg clonehttp://test:8002
然后在当地目录就会出现一个project.hg的一个copy.
修改Client端的配置
更改.hg/hgrc,加上default-push和username
[paths]
default =http://test:8002
default-push = ssh://hgrepo@test//home/hgrepo/project.hg/
[ui]
username=shaohui.zheng
如此你就可用hg push 向服务器提交code了。这个时候服务器会问你passward,这个password就是用户hgrepo的password.
Good Luck.
TAG标签:开源项目(1)
转载请说明来源于当下软件园(https://www.gpsdan.com)
本文地址:https://www.gpsdan.com/soft/7615.html
郑重声明:文章来源于网络作为参考,本站仅用于分享不存储任何下载资源,如果网站中图片和文字侵犯了您的版权,请联系我们处理!邮箱3450399331@qq.com