博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Gitolite 权限控制
阅读量:5354 次
发布时间:2019-06-15

本文共 4617 字,大约阅读时间需要 15 分钟。

官网

安装配置 

傻瓜安装教程 

快速指南(中文)

快速指南(英文)

1安装

1) 创建 git 用户

useradd gitpasswd changeit

2)使用root用户安装git

yum list gityum install git

3)安装 perl-Data-Dumper.x86_64 (因为执行 gitolite/install 时的异常 Can't locate Data/Dumper.pm in @INC

yum list perl*Dumper*yum install perl-Data-Dumper.x86_64

4)切换到 git 用户并克隆 gitolite 源码

su git                                        cd ~git clone https://github.com/sitaramc/gitolite

 

./install -to 
to copy the entire 'src' directory to
. If
is not in $PATH, use the full path to run gitolite commands. Please provide a full path, not a relative path.
5)安装 gitolite 
ls gitolite -l./gitolite/install -to ~/bin

 

Usage:  gitolite setup [
6)上传并设置 public key ,公钥文件名即账户名 
./bin/gitolite setup -pk zxg.pub

 

7)在服务器端显示自动创建的仓库的目录结构

./repositories/gitolite-admin.git/./repositories/gitolite-admin.git/HEAD./repositories/gitolite-admin.git/logs./repositories/gitolite-admin.git/logs/HEAD./repositories/gitolite-admin.git/logs/refs./repositories/gitolite-admin.git/logs/refs/heads./repositories/gitolite-admin.git/logs/refs/heads/master./repositories/gitolite-admin.git/index./repositories/gitolite-admin.git/description./repositories/gitolite-admin.git/COMMIT_EDITMSG./repositories/gitolite-admin.git/hooks./repositories/gitolite-admin.git/hooks/pre-push.sample./repositories/gitolite-admin.git/hooks/post-update./repositories/gitolite-admin.git/hooks/prepare-commit-msg.sample./repositories/gitolite-admin.git/hooks/update.sample./repositories/gitolite-admin.git/hooks/commit-msg.sample./repositories/gitolite-admin.git/hooks/pre-rebase.sample./repositories/gitolite-admin.git/hooks/update./repositories/gitolite-admin.git/hooks/pre-commit.sample./repositories/gitolite-admin.git/hooks/pre-applypatch.sample./repositories/gitolite-admin.git/hooks/applypatch-msg.sample./repositories/gitolite-admin.git/hooks/post-update.sample./repositories/gitolite-admin.git/gl-conf./repositories/gitolite-admin.git/branches./repositories/gitolite-admin.git/refs./repositories/gitolite-admin.git/refs/tags./repositories/gitolite-admin.git/refs/heads./repositories/gitolite-admin.git/refs/heads/master./repositories/gitolite-admin.git/objects./repositories/gitolite-admin.git/objects/内容略./repositories/gitolite-admin.git/config./repositories/gitolite-admin.git/info./repositories/gitolite-admin.git/info/exclude

 

8) 在客户端验证该服务是否成功

git ls-remote git@123.206.22.178:gitolite-admin

 

结果(显示的是gitolite-admin 仓库内容):

e173b96b63241df3946f5babd0fcdc819a4eb0df        HEADe173b96b63241df3946f5babd0fcdc819a4eb0df        refs/heads/master

 

2 授权

1) 克隆 gitolite-admin 仓库到本地

git clone git@123.206.22.178:gitolite-admin

其目录结构为:

└─gitolite-admin    ├─conf    │      gitolite.conf    │    └─keydir            zxg.pub

2)假设为小红授权

① 将 xiaohong.pub 复制到 keydir 下

② 编辑 gitolite.conf 文件追加如下内容:

repo foo    RW+     =   xiaohong    R       =   zxg

③ add 、commit 、push 三步提交到服务器即可

 

3)权限控制

access rule examples

Gitolite's access rules are very powerful. The simplest use was already shown above. Here is a slightly more detailed example:

repo foo    RW+                     =   alice    -   master              =   bob    -   refs/tags/v[0-9]    =   bob    RW                      =   bob    RW  refs/tags/v[0-9]    =   carol    R                       =   dave

Here's what these example rules say:

  • alice can do anything to any branch or tag -- create, push, delete, rewind/overwrite etc.

  • bob can create or fast-forward push any branch whose name does not start with "master" and create any tag whose name does not start with "v"+digit.

  • carol can create tags whose names start with "v"+digit.

  • dave can clone/fetch.

Please see the main documentation linked above for all the gory details, as well as more features and examples.

groups

Gitolite allows you to group users or repos for convenience. Here's an example that creates two groups of users:

@staff      =   alice bob carol@interns    =   ashokrepo secret    RW      =   @staffrepo foss    RW+     =   @staff    RW      =   @interns

Group lists accumulate. The following two lines have the same effect as the earlier definition of @staff above:

@staff      =   alice bob@staff      =   carol

You can also use group names in other group names:

@all-devs   =   @staff @interns

Finally, @all is a special group name that is often convenient to use if you really mean "all repos" or "all users".

转载于:https://www.cnblogs.com/zno2/p/7592632.html

你可能感兴趣的文章
C# Fade Form Effect With the AnimateWindow API Function
查看>>
golang多维数组的切片
查看>>
IP 网际协议
查看>>
C语言_第五章__实践(密码转换)
查看>>
docker 容器后台运行命令
查看>>
jquery 获取css position的值
查看>>
面向对象的程序设计
查看>>
a标签添加点击事件
查看>>
Context.startActivity出现AndroidRuntimeException
查看>>
Intellij idea创建javaWeb以及Servlet简单实现
查看>>
代理网站
查看>>
Open multiple excel files in WebBrowser, only the last one gets activated
查看>>
FFmpeg进行视频帧提取&音频重采样-Process.waitFor()引发的阻塞超时
查看>>
最近邻与K近邻算法思想
查看>>
【VS开发】ATL辅助COM组件开发
查看>>
FlatBuffers In Android
查看>>
《演说之禅》I & II 读书笔记
查看>>
thinkphp3.2接入支付宝支付接口(PC端)
查看>>
response和request
查看>>
【转】在Eclipse中安装和使用TFS插件
查看>>