我正在寫一個後收到鉤,看起來像這樣:掛鉤是否在git目錄或掛鉤目錄中運行?
#!/bin/sh
# this file is in root.git/hooks
# deprecated
# git --work-tree=~/public_html --git-dir=~/root.git checkout -f
cd /home/username/www
git add -A .
git commit -m "automated commit on push"
# cd /home/username/root.git/hooks
# cd /home/username/root.git
#git pull x
#git push y
我變成一個git回購協議add/commit
,我需要回到我的裸回購和做pull/push
。
我應該回到鉤子目錄或只是git目錄。
注意,鉤與的環境變量'$ GIT_DIR'集運行,通常以'.'或'.git',所以如果你在其他地方CHDIR必須調整或取消'$ GIT_DIR'(因此' - -git-dir ='在註釋掉的命令中)。 – torek
@torek - 你可以對Jan的評論發言嗎?他似乎認爲它將以root.git/w運行'--git-dir'選項。我要測試一下。 –