Git hook creation - You are on a branch yet to be born

随声附和 提交于 2019-11-28 02:11:45

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/25583072/git-hook-creation-you-are-on-a-branch-yet-to-be-born

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!