1

So I was searching and can't find how to set up git hook with wordpress

I added a deploy.php to my public_html directory where is my wordpress blog!

so when I commit to git stuff, something server doesn't pull it and when I type www.example/depoly.php

it shows error 404 page not found its there any way to make wordpress avoid that file and just execute content:<pre> <?php system("git pull");?> </pre>

ANY HELP THANKS:)

boska0712
  • 65
  • 7

1 Answers1

0

Use post-receive hooks to trigger automated deployment. The post-receive hook will automatically will automatically be triggered by Git.

As an example - In hooks/post-receive put the following

GIT_REPO=$HOME/myrepo.git
PUBLIC_WWW=/var/www/myrepo

cp $GIT_REPO $PUBLIC_WWW

If you require further detailed documentation - http://git-scm.com/book/en/Customizing-Git-Git-Hooks

An example of automated deployment on website - http://www.sitepoint.com/one-click-app-deployment-server-side-git-hooks/

First Zero
  • 21,586
  • 6
  • 46
  • 45
  • 1
    Hi, Stash developer here. Just wanted to point out that if this hook is going in Stash that you need to put the hook in the hooks/post-receive.d instead, as we hijack the post-receive file to detect when a push is complete. You could also write the plugin as a Repository Hook plugin if you wanted to as well. – charleso Jan 21 '14 at 10:40
  • Aha, that's great to know. Thanks. – First Zero Jan 21 '14 at 12:09