I have a PHP file, hook.php, that looks like this:
hook.php
The file is located in /var/www/ol
/var/www/ol
create webhook.php in the root or anywhere from where you can access it
$result = exec("cd /path/to/repo && git pull origin branch");
make sure the permission is 775 and user of your file and your site directory is www-data owner