I know this might sound odd or might probably be a duplicated question but have searched and could not find any possible solutions.
I want to auto-deploy my code from bitbucket to my server. I created an ssh key and linked them, created a bare git folder that the code goes to and then a production folder which carries the live site. I added a webhook to bitbucket that should execute anytime I run a push to my repository. My challenge now is, the script is executed but I don't see any changes, but If I manually write the command in the console, everything works fine. Please help. I'm running a Linode server with a debian 9 OS. This is the code from my deployment script. Please help me. I have on this for 4 days now.
<?php
$repo_dir = '/var/www/git/_ku1bo__c_plus_z_.git';
$web_root_dir = '/var/www/html/kobuplus.com/public_html';
$git_path = '/usr/bin/git';
exec("cd $repo_dir" && "$git_path fetch");
exec("cd $repo_dir" && "GIT_WORK_TREE=$web_root_dir $git_path checkout -f");
file_put_contents("deploy.log", date("m/d/Y h:i:s a") . "deployed latest branch" . "\n", FILE_APPEND);
?>