1

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

littleswany
  • 473
  • 2
  • 6
  • 18

1 Answers1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have tried that, for this bit "GIT_WORK_TREE=/var/www/www.example.org git checkout -f" after the = what address should i put? – littleswany Aug 30 '14 at 14:05
  • @littleswany you should put any path you want your website content to be checked out (in this example `/var/www/www.example.org`), which in turn would be referenced by your http server `DocumentRoot`. – VonC Aug 30 '14 at 14:07
  • 1
    @littleswany this is the folder in which your website is checked out. But you still need to set up an web server which will let you use a "web address" (an url) translated internally into this folder (the DocumentRoot). – VonC Aug 30 '14 at 14:11
  • @littleswany see an example of said web server and `DocumentRoot` setting in http://git-scm.com/book/en/Git-on-the-Server-Public-Access – VonC Aug 30 '14 at 14:18