Git Server 架設

建立 Git 共用端

1
git init --bare <專案名稱.git>

設定 Git 共用端

1
vim <專案名稱.git>/hooks/post-receive
1
2
3
4
#!/bin/sh
WEB_DIR="/home/zhong666/Sites"
git --work-tree=${WEB_DIR} clean -fd
git --work-tree=${WEB_DIR} checkout --force

增加執行權限

1
chmod +x post-receive

完成

接下來就可以由一般取得git repo一樣

從遠端克隆
1
git clone user@ip:<專案名稱.git>
從本機加入
1
git add remote origin user@ip:<專案名稱.git>