更新後スクリプトを作成し、git をリモート サーバー上の展開ツールとして使用しようとしています。
私の更新後のスクリプトは次のようになります
git update-server-info
for ref in $@;do
echo $ref
if [ "$ref" = "refs/heads/production" ]
then
ssh git@myProductionServer.com GIT_WORK_TREE=/home/www/test git checkout -f production
fi
done
ただし、それを実行すると、次のようなエラーが返されます。
Not a git repository (or any of the parent directories): .git
ディレクトリ内からssh経由でgitコマンドを実行できるため、これは意味がありません。
更新後のスクリプトで行う必要があることは他にありますか?
解決
変数を追加したGIT_DIR
ので、コマンドは次のようになります。
ssh git@myProductionServer.com GIT_DIR=/home/www/test/.git GIT_WORK_TREE=/home/www/test git checkout -f production