假设仓库目录为 /var/repo/hexo.git,实现每次提交后都自动检出到 /var/www/html。
第一步:创建一个 post-commit 文件。
1 | cd /var/repo |
第二步:添加如下内容
1 |
|
第三步:添加可执行权限
1 | chmod +x .git/hooks/post-commit |
除此之外,还要注意一下 git 用户的权限问题。
假设仓库目录为 /var/repo/hexo.git,实现每次提交后都自动检出到 /var/www/html。
第一步:创建一个 post-commit 文件。
1 | cd /var/repo |
第二步:添加如下内容
1 |
|
第三步:添加可执行权限
1 | chmod +x .git/hooks/post-commit |
除此之外,还要注意一下 git 用户的权限问题。