通过我的Symfony项目,我想提交并立即推送我上传的图像。目前,只有推动不起作用。对于其他命令,我这样做:
exec('git add myfile');
exec('git -c user.name="My User Name" -c user.email="my email" commit -m "My Commit"');
对于推送,我尝试这样做:
$branch = exec("git branch | grep \* | cut -d ' ' -f2");
exec('git push https_link '.$branch);
我没有错误,没有输出,juste我的脚本待了很长时间,我需要重新启动Apache。这是一个简单的身份验证(我在https上使用我的专用URL bitbucket)然后我不需要密码。我也尝试使用proc_open,但它是一样的。我看到库https://github.com/kbjr/Git.php但我没有到达安装它与Symfony
您需要找到错误消息。如果您使用Symfony,您应该使用Process Component。最有可能是对bitbucket进行身份验证的问题。不要忘记PHP通常在不同的用户下运行,因此所有SSH config / ENV变量都不同。
有了它,就会有类似的东西
$process = new Process(array('ls', '-lsa'));
$process->run('git -c user.name="My User Name" -c user.email="my email" commit -m "My Commit"');
$output = $process->getOutput(); // here you should see the output - Time to find where is problem