I want to execute git clone
in my php. As the code below:
<?php
exec('git clone git@github.com:xxx/xxx.git /home/xxx',
$out);
foreach($out as $info){
echo $info."</br>";
}
?>
After execute it, the target project is not clone into my local directory and the $info
has no data and there are no error information.
I try git clone
in my bash script, and it can achieve clone. The code as below:
#!/bin/sh
git clone git@github.com:xxx/xxx.git /home/xxx
And it seemed I can use git add
in php, So why git clone
is so particular that I cant execute it in my php file.
edit: I think it is not same as How can I debug exec() problems?
. I find that I can execute this php with cli, in this way git clone
will achieve its task. But git clone
will be lazy with fpm.