post-commit
コミットが成功するたびに、次のフックを使用して特定のディレクトリにデプロイしようとしています。
#!/bin/sh
export GIT_WORK_TREE=/var/www/example/
export GIT_DIR=/home/mark/test/.git/
git checkout -f
ただし、コミット後に次のエラーが発生します。
$ git commit -m 'An example commit.'
fatal: Unable to create '/var/www/example/.git/index.lock': No such file or directory
[master 0938e48] An example commit.
...あたかもGIT_WORK_TREE
設定が無視されているかのように。この環境変数の設定が機能していないように見えるのはなぜですか? 私はgitバージョン1.7.4.1を使用しています。