2014-09-05 89 views
0

這是一個更新後的鉤子(從here開始),我已經在服務器上的裸倉庫中設置。它部署在GIT_WORK_TREE整個存儲庫的路徑:使用Git post-update鉤子部署/ dist的repo文件夾

#!/bin/sh 
export GIT_WORK_TREE=/path/to/you/live/files 
git checkout -f 

如何設置在一個Git的post-update掛鉤,以僅部署庫下的dist /文件夾?

回答

1

試試這個,基地之一這answer

#!/bin/sh 
cd /path/to/you/live/files 
git archive --remote=<repo_url> <branch> dist | tar xvf - 
+0

的感謝!有關於[這裏]的更多信息(http://wildlyinaccurate.com/deploying-a-git-repository-to-a-remote-server)。儘管我用Git語法感到頭痛,然後我最終意識到我不需要服務器上的裸存儲庫,我只是在dist /文件夾中解決了我的問題。 – zok 2014-09-05 21:00:01