I am trying to create a git commit and push it to the remote repo every time my client updates their Wordpress plugins or core. I have successfully hooked into the correct filter so I can execute php code once the updates are done, and I can even create a commit, but I have no luck pushing to remote.
I am using the following code:
system ( 'cd '.ABSPATH.'; git add -A;' );
system ( 'cd '.ABSPATH.'; git commit -a -m "Updated plugins via WP";' );
system ( 'cd '.ABSPATH.'; echo `git push`;' );
The first 2 lines work great! They produce output as well. However, the 3rd line does NOT work. And there is no output produced. When I check my repo, the changes have not been pushed to remote. When I manually do git push via terminal/shell, it pushes successfully and it produces output.
I must be missing something obvious?
system ( 'cd '.ABSPATH.'; git push;' );