创建远程仓库
cd /lnmp/git/
git init --bare bootstrap.git
在服务器clone一个仓库
cd /lnmp/www
git clone /lnmp/git/bootstrap.git
为远程仓库编写hook
cd /lnmp/git/bootstrap.git/hooks
vi post-receive
post-receive 里的脚本
##!/bin/sh
unset GIT_DIR
DeployPath=/lnmp/www/bootstrap
cd $DeployPath
git add . -A && git stash
git pull origin master
给post-receive添加可执行权限
chmod +x post-receive
- bootstrap.git post-receive bootstrap 都把所属用户设置成git的