1. 更新git版本: http://codelife.me/blog/2013/06/25/upgrade-git-on-centos-6-4/
2. 建立git仓库:
- git init --bare myrepo.git # 建立代码仓库
- chgrp -R git /opt/myrepo.git # 更改属组
- chmod g+rsw -R /opt/myrepo.git # 给组 读写权限
- #每次有人push后,设置 新文件的属组是 新属组git,
- echo “#!/bin/sh chgrp -R git . 2>/dev/null” > /opt/myrepo.git/hooks/post-update
- chmod g+x /opt/myrepo.git
- # 组共享代码
- cd /opt/myrepo.git
- git config –add core.sharedRepositoy group
- # checkout 代码
- git clone user_name@vps_host:/opt/myrepo.git myrepo.git