GIT服务端部署钩子自动同步代码
- 开发技术
- 2019-09-09
- 942
- 0
hooks/post-receive 该文件内容
!/bin/sh
DEPLOY_PATH=/data/test #项目目录
unset GIT_DIR #这条命令很重要
cd $DEPLOY_PATH
date >> /data/git/log.txt
git fetch origin >> /opt/log.txt
git reset —hard origin/master >> /opt/log.txt
搭建git服务端请参考下面链接
https://www.runoob.com/git/git-server.html