首页 > 其他 > 详细

GIT服务器项目部署和自动同步

时间:2018-10-25 15:13:07      阅读:154      评论:0      收藏:0      [点我收藏+]

1.1、初始化Git仓库
首先我们选定一个目录作为Git仓库,假定是/home/data/share/share.git,在/home/data/目录下输入命令:

$ cd /home/data/
$ mkdir share
$ chown git:git share/
$ cd share

$ git init --bare share.git
Initialized empty Git repository in /home/data/share/share.git/

 

以上命令Git创建一个空仓库,服务器上的Git仓库通常都以.git结尾。然后,把仓库所属用户改为git:

$ chown -R git:git  share.git

 

1.2 配置自动同步

$ cd /home/data/share/share.git/hooks

vim post-receive

#!/bin/bash
git --work-tree=/web/share checkout -f

chmod -R 777 post-receive

 

1.3检出代码,到nginx指定的项目目录

cd /web
git clone /home/data/share/share.git/
chmod -R 777 share

 

 Windows客户端: 

git clone git@39.107.77.206:/home/data/share/share.git

 

GIT服务器项目部署和自动同步

原文:https://www.cnblogs.com/haozhen/p/9849722.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!