git-server-2-www.md

install git

1
yum install git

check

1
git --version

git version 1.8.3.1

server side

1
2
3
cd /home
mkdir myrepo
git init --bare /home/myrepo/gs.git

client side

git clone root@blog.guoshuang.com:/home/myrepo/gs.git

git add .

git commit -m ‘hi,test’
git push

hooks

cd hooks

创建post-receive文件

vim post-receive

输入以下内容

1
2
#!/bin/bash
git --work-tree=/home/guoshuang/nginx/html/blog checkout -f
1
chmod +x post-receive

-https://juejin.im/post/5c7e4e43f265da2d980923a6
-https://www.digitalocean.com/community/tutorials/how-to-create-a-blog-with-hexo-on-ubuntu-14-04