Sunday, December 13, 2015

Post Receive

I've got my website running as a git server, basically when I git push to it git copies the project files into a folder I specify. All you have to do is set up your git repo on the server using git init --bare, then add a file to the hooks directory and give it executable permissions. Check out the contents of the post-receive file below. 

GIT_WORK_TREE="../serve" git checkout -f master

That's it, just one line in the file and my whole project gets updated and put into the ../serve directory.

No comments:

Post a Comment