$commitMessage = 'Auto commit from admin panel '.date('d.m.Y H:i:s', time());
chdir(__DIR__.'/../../../..');
$res[] = shell_exec('git add --all 2>&1');
$res[] = shell_exec('git commit -a -m "'.$commitMessage.'" 2>&1');
$res[] = shell_exec('git push origin master 2>&1');
$res[] = shell_exec('git status 2>&1');
git push 命令后的输出:
主机 key 验证失败。致命:无法从远程存储库中读取。请确保您具有正确的访问权限并且存储库存在。
但在我运行以下命令之前:
sudo -u www-data ssh-keygen -t rsa
sudo chown www-data:www-data -R ~/.ssh/known_hosts
sudo chown www-data:www-data -R /project
(在哪里找到 .git 目录)
在我将 ssh key 添加到 bitbucket ssh key 之后(不用于部署)。
请您参考如下方法:
此错误意味着您要连接到的域的主机 key (我假设是您的评论中的 bitbucket)已更改。不同的是他们的 key ,而不是你的。
我会检查他们最近是否更改了主机 key ,如果有,您可以删除旧 key
$ ssh-keygen -R bitbucket.org
但要小心,未知的主机 key 可能意味着中间人攻击。因此,在执行此操作之前,请确保它确实是 bitbucket 的 key 。




