Github account password is required to execute git pull with php's shell_exec

use php to do the webhook of github, as follows:

        $cmd = "eval `ssh-agent -s` && ssh-add && cd $target && git pull 2>&1";
        $res = shell_exec($cmd);

ssh key (no password) has been added, no error returned, but not successful.

$cmd = "cd $target & & git pull 2 > & 1"; prompts you that there is no permission because key should not be loaded.

May.24,2022

git remote-v shows whether it is ssh or https connection. The warehouse address is below mosaic

.
Menu