Lion下Git服务器搭建

来源:互联网 发布:表单用javascript 编辑:程序博客网 时间:2024/05/17 08:54

前面有篇Mountian Lion的Git服务器搭建,这篇是Lion的。从Mountian Lion之后就取消Web Sharing,所有Lion和Mountian Lion有点点区别。

1、googlecode中下载git-1.7.8.4-intel-universal-snow-leopard.dmg
2、双击运行git-1.7.8.4-intel-universal-snow-leopard.pkg
3、可选执行setup git PATH for non-terminal programs.sh
4、打开System Preferences,进入Sharing,并勾选Web Sharing
5、下载Gitbox图形化工具
6、Xcode创建一个工程,并用Gitbox ‘New Reposit‘.(假设这时本地库在/Desktop上,工程名为“GitTest”)
7、运行Terminal,运行命令 git clone --bare -l /Users/yourname/Desktop/GitTest /Users/yourname/Desktop/GitTest.git(实际上x.git为文件夹)
8、将上述文件夹拖入到/Library/WebServer/Documents文件夹下
9、运行命令cd /Library/WebServer/Documents/GitTest.git 和 git update-server-info(后面命令一定要执行)
10、再运行touch git-daemon-export-oksudo /usr/local/git/libexec/git-core/git-daemon --base-path=/Library/WebServer/Documents/ --syslog --verbose --pid-file=/var/run/git-daemon.pid --user=_www --group=_www --detach --enable=upload-pack --enable=upload-archive --enable=receive-pack  
(base-path参数指出web服务器的Documents目录为git服务器基础目录,git-daemon会扫描该目录下所有尾缀为.git的目录,如果这些目录下有git-daemon-export-ok文件,则将此目录作为git协议的输出repository,用户和用户组都设为_www,与web服务器相同。)
11、最后运行命令sudo chown -R www:www /Library/WebServer/Documents(该步骤是因为不运行chown时,x.git文件夹权限不为_www)