Git后接收钩与shell不同 [英] Git post-receive hook acts differently to shell
问题描述
我正在尝试在我的实时服务器上设置一个git repo,以便自动更新接收到的子域。使用本指南 http://toroid.org/ams/git-website-howto
I'm trying to setup a git repo on my live server to automatically update a subdomain on receive. Using this guide 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 子域更新。
但是,当我推我得到以下输出:
If I run git checkout -f in /var/git/domain.com.git/ it works, the subdomain is updated. However, when I push I get the following output:
/var/git/domain.com.git
fatal: This operation must be run in a work tree
我不知道为什么这样在壳中工作,但不在挂钩。任何人都可以启发我吗?
I'm not sure why this works in the shell, but not in the hook. Can anyone enlighten me?
推荐答案
工作树上的权限不允许读取,导致 fatal:此操作必须在工作树中运行
错误。
The permissions on the worktree do not allow it to be read which causes the fatal: This operation must be run in a work tree
error.
这篇关于Git后接收钩与shell不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!