2023-03-01

GIT实现自动部署 

$ git init --bare myproject.git
$ cd myproject.git/hooks
$ vim post-receive
#!/bin/sh
TARGET="/var/www/blog"
GIT_DIR="/root/git/blog.git"
BRANCH="master"
git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
$ chmod +x post-receive

 

标签: GIT