I have a repository for project which is on Bitbucket. I clone the repo to my local PC to work on it. Then I push back to Bitbucket, and then I connect with putty to my server and call
git pull
And pull the changes to the live server. I never push from my server. Everything works fine like this, but its not very convenient to connect through putty to server in order to pull. I made small script “git_pull_script.sh” in where is something like:
git reset --hard
git clean -f
git pull
chown -f -R tdadmin *
...
Nothing problematic there. If I run the script on server
bash /home/tdadmin/git_pull_script.sh
Everything goes well and does what I need. Just to clarify, git_pull_script has set owner and group tdadmin.
Now in order to make it simpler for me, I wrote this tiny php script.
<?php
exec('bash /home/tdadmin/git_pull_script.sh', $output);
print_r($output);
which I think should do the work. So I could simply call http://tddomain.com/pullscript.php
Unfortunately that does not work. What did I do wrong?
The problem was in the file system rights. Even though have changed all permissions, “.git” repository folder stayed with root owner and group. Once I changed that, everything works just fine