gitlab Webhook触发生产.phpurl从主分支拉文件 – 它是安全和正确的?

这是我第一次探索从gitlab到生产服务器(数字海洋)的webhook&autodeploy,

当我从本地机器推送文件时,我会在webhook上触发一个url( http://example.com/git/hook/pull-master.php )。

以下是pull-master.php的代码:

$cmd = "git pull https://usr:[email protected]/johndoe/project.git master"; echo shell_exec($cmd);

我可否知道

  1. 以上autodeploy方法安全吗?
  2. 生产服务器可以.git文件夹? 假设项目目录在.git中大约。 100MB〜500MB

以上autodeploy方法安全吗? 这是开发人员如何自动部署代码到他们的分段/生产服务器的常用方式?