首页 > 系统服务 > 详细

linux 创建git 仓库

时间:2017-12-12 18:24:20      阅读:212      评论:0      收藏:0      [点我收藏+]
#创建一个工作区
mkdir test_work

#创建一个git 仓库(服务库,非工作区)
mkdir test_git 
cd test_git
git init --bare

# 创建一个post-receive 勾子,用于提交代码后,自动将代码更新到 工作区 test_work
vim ./hooks/post-receive

#! /bin/sh
GIT_WORK_TREE=test_work git checkout -f
sudo chmod -R 777 test_work

# 将以上三行shell 写入 post-receive 文件里,
# 上面test_work 是你的工作区,路径写绝对路径
# 写完之后,保存退出vim 编辑器

#修改工作区的用户和用户组,用于 git 的receive 勾子有权限更新
chown git:git -R test_work

#修改test_git 仓库的用户和用户组,并给 post-receive 文件 增加执行权限
chown git:git -R test_git
chmod +x test_git/hooks/post-receive

 

linux 创建git 仓库

原文:http://www.cnblogs.com/cidgur/p/8028932.html

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