Git post-receive hook对shell的行为不同

时间:2009-12-13 23:01:58

标签: git deployment hook

我正在尝试在我的实时服务器上设置git repo,以便在接收时自动更新子域。使用本指南http://toroid.org/ams/git-website-howto

钩/后接收

#!/bin/sh
pwd
git checkout -f

配置

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        worktree = /var/www/vhosts/domain.com/subdomains/staging/httpdocs
[receive]
        denycurrentbranch = ignore

如果我在/var/git/domain.com.git/中运行git checkout -f ,它就可以运行,子域名会更新。 但是,当我按下时,我得到以下输出:

/var/git/domain.com.git
fatal: This operation must be run in a work tree

我不确定为什么这在shell中有效,但不在钩子中。谁能开导我?

2 个答案:

答案 0 :(得分:1)

cd /var/www/vhosts/domain.com/subdomains/staging/httpdocs添加到您的收件后挂钩。

答案 1 :(得分:0)

工作树上的权限不允许读取导致fatal: This operation must be run in a work tree错误的权限。

相关问题