mkdir ${PROJECT}.git cd ${PROJECT}.git git --bare init
然後在本機裡加入
git remote add origin file:///${PROJECT}.git
上傳更新本地位址
在${PROJECT}.git底下的hooks資料夾加入post-receive並寫入以下bash (檔案權限須改成755)
#!/bin/bash while read oldrev newrev refname do if [ "$refname" == "refs/heads/master" ]; then break; fi done if [ "$refname" != "refs/heads/master" ]; then exit; fi branch=$(git rev-parse --symbolic --abbrev-ref $refname) git --work-tree=要覆蓋的位址 checkout -f $branch