Git钩子的创建 - 你在一个分支尚未出生 [英] Git hook creation - You are on a branch yet to be born
问题描述
所以即时通讯设置一个git并遵循本指南 http://toroid.org/ams/ git-website-howto 。
我得到这个命令:
#GIT_WORK_TREE = / home3 / trncprop / public_html / tpcapp git checkout -f
然后得到以下错误消息:
fatal:你在一个分支尚未出生
$ c
有谁知道我在做什么错?
预先感谢! Littleswany
解决方案该命令应该在钩子中,而不是直接在网站中执行。 git
$ cat> hooks / post-receive
#!/ bin / sh
GIT_WORK_TREE = / var / www / www.example.org git checkout -f
$ chmod + x hooks / post-receive
这意味着您需要创建一个website.git / hooks / post-receive文件,并使用该命令,并使其成为可执行文件。
这将允许您将提交顶部的裸回购(website.git),这将触发post-receive钩子,并将结帐将回购内容放入不同的工作树中。
So im setting up a git and following this guide http://toroid.org/ams/git-website-howto.
I get as far as this command:
# GIT_WORK_TREE=/home3/trncprop/public_html/tpcapp git checkout -f
And get the following error message
fatal: You are on a branch yet to be born
Does anyone know what I am doing wrong?
Thanks in advance! Littleswany
解决方案 That command is supposed to be in a hook, not to be executed directly in website.git
$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
$ chmod +x hooks/post-receive
That means you need to create a website.git/hooks/post-receive file, with that command in it, and make it executable.
That will allow you to push commits top that bare repo (website.git), which will trigger the post-receive hook, and will checkout the repo content into a different working tree.
这篇关于Git钩子的创建 - 你在一个分支尚未出生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!