如何在远程服务器上运行Satis?

时间:2019-12-04 05:49:19

标签: git ssh composer-php satis

有一个运行Satis的命令:php bin/satis build satis.json response

Satis本身位于服务器上,例如example.com/satis

如何在服务器上远程运行命令?

我尝试使用命令shell_exec('php bin/satis build satis.json response/')编写脚本,但是在Satis无法登录Git时遇到错误:

Scanning packages
Failed to clone the git@gitlab.com:project/project.git repository, try running in interactive mode so that you can enter your credentials

In Git.php line 354:

  Failed to execute git clone --mirror 'git@gitlab.com:project/project
  .git' '/var/www/.composer/cache/vcs/git-gitlab.com-project.git/'                                                                         

  Cloning into bare repository '/var/www/.composer/cache/vcs/git-gitlab.com-project.git'...                                                
  Host key verification failed.                                                
  fatal: Could not read from remote repository.                                

  Please make sure you have the correct access rights                          
  and the repository exists.                                                   


build [--repository-url [REPOSITORY-URL]] [--repository-strict] [--no-html-output] [--skip-errors] [--stats] [--] [ [ [...]]]

哪里有问题?

1 个答案:

答案 0 :(得分:0)

  

主机密钥验证失败。

您的命令可能不是与服务器上的一个管理员满意的用户执行的。

这意味着$HOME不相同,并且$HOME/.ssh/known_hosts(用于验证远程主机的主机密钥)不存在或不相同。

至少尝试shell_exec('id -a; env')来检查通过shell_exec()调用看到的用户/环境。