php - Github <> remote server, auto deploy, the webhook doesn't work -


when push github project local computer, want remote server pull automatically (its php website project)

i've searched on google , youtube having spent entire day didn't find how that.

in http://xxx.xxx.xxx.xxx/website/, there .git folder , github.php file deploy

github.php :

<?php `git pull origin master`; `touch test.txt`; 

if execute ./github.php terminal, "script" works well. pull works too.

if enter url http://xxx.xxx.xxx.xxx/website/github.php, browser, pull doesn't work, test.txt created.

if push commit local computer, remote server doesn't pull automaticaly , test.txt file isn't created;

in remote server, permissions :

  • for .git directory : drwxrwxrwx 8 toji toji 4096 jun 14 13:31 (-r)

  • for github.php : -rwxrwxrwx 1 toji toji 51 jun 14 13:28

in github account, add webhook service : payload url : http://xxx.xxx.xxx.xxx/website/github.php

please me determine origin of problem.

i don't think php valid since need use exec() use git in php... had same problem few days ago , found little tools deploy code github or gitlab created deepl.io handle web-hooks , call scripts deploy on own server. handles json that's sent github or gitlab , can used multiple repositories , branches etc. can use own php or shell scripts after receiving pull notification , sends status e-mails after every deploy... check out: http://deepl.io

the shell scrip executed (called php) follows;

#!/bin/sh  traget="/path/to/target/folder" log="/path/to/your/log/file.log" now=$(date +"%y-%m-%d-%h%m%s")  # start sctipt echo " script start: $now" >> $log  cd $traget >> $log  # checkout correct branch git checkout master >> $log  # clear untracked files git clean -df >> $log  # revert local changes git checkout -- . >> $log  # pulling new stuff git pull >> $log  echo "script end. " >> $log 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -