Trigger a git pull at URL request

Hello Forum,

My question is how to automaticly deploy a project to another server if a developer succesfully have built it and pushed?
Here is what I’ve done so far: (I’m on gitlab.com, not custom server, yet)

  • Created a .gitlab-ci.yml to build my laravel 5 project (works like a charm)
  • Created a post-recieve hook in the .git/hook folder with the following in it:
#!/bin/sh
echo "Triggering the code deployment ..."
wget -q -O /dev/null https://my.website.com/deploy.php
  • Created the deploy.php mentioned above with the following in it:

http://pastebin.com/1kE4rye2

What happens: Nothing.
When I go to the deploy.php manually it shows me that pretty site, writes out information about echo $PWD, whoami, git status (no changes, etc…) and that’s it. Why doesn’t it executes the pull and the rest?