我正试图用一个单独的工作树创建一个Git repo。我严格遵循了本教程:http://caiustheory.com/automatically-deploying-website-from-remote-git-repository
我可以从我的本地回购中承诺并推送到我的远程。我指定为工作树的文件路径不包含我推送的文件。
我认为文件路径可能不正确(我在MediaTemple GS上),但Git在我推送时不会抛出任何错误。
这是我的遥控器的配置:
[core]
repositoryformatversion = 0
filemode = true
bare = false
worktree = /home/xxxxx/domains/xxxxxx.com/html/b
[receive]
denycurrentbranch = ignore
我的帖子接收和帖子更新挂钩都是777,都包含以下内容:
#!/bin/sh
git checkout -f
如果能提供任何帮助,我将不胜感激。
谢谢,
--Nick
你会想要这样的东西:
https://github.com/richo/git_template/blob/master/hooks/post-receive
或者更简洁地说:
#!/bin/sh
# Kludge to read the last ref
while read old new ref; do
real_sha=$new
done
GIT_WORK_TREE=$PWD/../ git checkout -qf $real_sha
基本上,新的ref被传递到stdin中的post-receive
中,因此您需要手动读取它们。
你的钩子正在做的是强制检查现有的参考