次のようなファイル パスを使用して、サーバーに 2 つの裸の git リポジトリをセットアップしました。
/git/project.git/
/git/project2.git/
次に、dev と live の 2 つのブランチを追加しました。次に、各プロジェクトに次の受信後フックを追加しました
`
#!/bin/sh
while read oldrev newrev refname
do
echo "STARTING [$oldrev $newrev $refname]"
if [ "$refname" == 'refs/heads/dev' ]
then
GIT_WORK_TREE=/var/www/vhosts/devwebsite.com/httpdocs/ git checkout -f
elif [ "$refname" == 'refs/heads/live' ]
then
GIT_WORK_TREE=/var/www/vhosts/livewebsite.com/httpdocs/ git checkout -f
fi
done`
これは 1 つのプロジェクトでは機能しますが、他のプロジェクトでは機能しません。2番目のプロジェクトでは、プッシュした最初のファイルでのみ動作するようです.gitignoreファイルです。
つまり、このファイルは、プッシュ時に更新される唯一のファイルです。