php通过proc_open提交git文件

$descriptorSpec = [
    0 => ["pipe", "r"],  // 标准输入,子进程从此管道中读取数据
    1 => ["pipe", "w"],  // 标准输出,子进程向此管道中写入数据
    2 => ["file", "/tmp/error-output.txt", "a"] // 标准错误,写入到一个文件
];
$process = proc_open("bash", $descriptorSpec, $pipes, "/tmp");
if (is_resource($process)) {
    fwrite($pipes[0], "cd " . $realApiDoc);
    fwrite($pipes[0], "\n");
    fwrite($pipes[0], "git pull");
    fwrite($pipes[0], "\n");
    fwrite($pipes[0], "git add README.md");
    fwrite($pipes[0], "\n");
    fwrite($pipes[0], "git commit -m  \"README.md\"");
    fwrite($pipes[0], "\n");
    fwrite($pipes[0], "git push");
    fclose($pipes[0]);
    echo stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    proc_close($process);
}