2018年7月

git直接push提交代码到线上生产环境

为方便开发过程中随时预览线上效果,需考虑git提交数据时直接将代码同时push到线上生产环境中。

  1. project.git/hooks新建post-receive

    #!/bin/sh
    git --work-tree=/www/project --git-dir=/data/git/project.git checkout -f

  2. chown +x post-receive
  3. 注意赋予project项目目录git写入权限