搭建git服务

2011年07月18日 留下评论

Git — The stupid content tracker, 傻瓜内容跟踪器。Git是一个分布式的版本控制工具,它有着比svn更加先进的功能。下面说一下如何搭建Git服务。

一 安装Git

ubuntu可以通过apt-get install git-core来安装,其他linux发行版可以通过源码安装http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2

二 搭建Git服务

首先假设我们要将代码仓库安装到/home/gxb/repo目录下。

依次运行

mkdir /home/gxb/repo

cd /home/gxb/repo

git  init –bare

touch git-daemon-export-ok

sudo git daemon –base-path=/home/gxb/repo –syslog –verbose –pid-file=/home/gxb/repo/git.pid –user=gxb –group=gxb  –detach –enable=upload-pack –enable=upload-archive –enable=receive-pack

这样如果顺利的话,Git服务就已经搭建好了

可以在其他目录运行 git clone git://localhost/ 来检出这个空项目

分类:git, linux 标签:,

利用help2man生成man手册

2011年02月14日 留下评论

gnu提供了很多很实用的工具,下面就介绍一个可以自动为我们的程序生成man手册的工具:help2man。help2man的主页在http://www.gnu.org/software/help2man/

使用help2man需要我们的程序可以接受–version和–help这两个参数,并且这两个参数是有输出内容的。help2man会利用可执行程序–version和–help的输出内容,来生成man手册。先举一个简单的例子,假设需要生成man手册的程序为main。它支持–version和–help这两个输入参数,并且输出为:

调用$ help2man ./main > manpage,这样就可以生成main的man手册了。

然后执行一下man ./manpage看一下效果

help2man在生成man手册的时候利用了一些关键字,比如Report bugs,Written by,Options ,Examples ,Copyright等。 因此我们输出的help信息越规范,生成的man手册也就越有条理。

help2man本身是一个perl脚本,我们可以通过阅读它的源码来继续深入了解它生成man手册的原理。

分类:linux 标签:,