Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...