I have a Github repository that I use via Atom.io with a client to help keep all the changes for their website synchronized. The GitHub repo contains a webhook that automatically pushes all our changes up to there live website, but I want to use PHP to push changes done directly on the webserver back up to the repo. ie: log file backups, image uploads and quick changes that were made direct on the server.
If one of these changes on the sever happens my scripts tell me about it no problem.
git status # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # new file: somefolder/somenewfile.whatever #
If I do this from the command line everything re-syncs perfectly:
git add --all git commit -m "from server" git push -u origin master
But if I try doing that via the PHP shell_exec() backticks
` ` nothing happens. I even tried adding pauses.
$output = `git add --all`; echo $output; sleep(1); $output = `git commit -m "from server"`; echo $output; sleep(3); $output = `git push -u origin master`; echo $output; sleep(3);
Anyone know what I'm doing wrong here? Should I be placing these calls in a bash script and then calling it via a PHP template?