2019独角兽企业重金招聘Python工程师标准>>>

CentOS6.*安装gitolite

安装基础包

# yum install perl openssh git

创建git用户

# adduser git
# passwd git

在git用户家目录下安装gitolite

切换到git用户

# su – git

创建文件夹bin

$ mkdir bin

克隆gitolite源码

$ git clone https://github.com/sitaramc/gitolite.git
$ ls
bin  gitolite

安装gitolite

$ ./gitolite/install -to /home/git/bin/

$ cd bin/
$ ls
commands  gitolite  gitolite-shell  lib  syntactic-sugar  triggers  VERSION  VREF

配置gitolite管理员

生成管理员账户的公钥(此处指定本地root用户为管理员,键入回车使用默认值)

# ssh-keygen

复制管理的公钥

# cp .ssh/id_rsa.pub /tmp/admin.pub

切换回git用户,为gitolite配置管理员

$ /home/git/bin/gitolite setup -pk /tmp/admin.pub
Initialized empty Git repository in /home/git/repositories/gitolite-admin.git/
Initialized empty Git repository in /home/git/repositories/testing.git/
WARNING: /home/git/.ssh missing; creating a new one
WARNING: /home/git/.ssh/authorized_keys missing; creating a new one

$ ls
bin  gitolite  projects.list  repositories

管理员日常管理

管理员clone管理库(此处为本地root用户)

# git clone git@192.168.213.130:gitolite-admin
Initialized empty Git repository in /root/gitolite-admin/.git/
The authenticity of host '192.168.213.130 (192.168.213.130)' can't be established.
RSA key fingerprint is d4:28:ca:66:58:b6:39:c1:aa:37:58:9a:5b:ed:50:05.
Are you sure you want to continue connecting (yes/no)? yes
# 此处因为第一次ssh连接,所以需要输入’yes’
Warning: Permanently added '192.168.213.130' (RSA) to the list of known hosts.
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (4/4), done.
Receiving objects: 100% (6/6), 748 bytes, done.
remote: Total 6 (delta 0), reused 0 (delta 0)

# pwd
/root/gitolite-admin
# ls
conf  keydir

创建库、添加用户
例如某test123用户访问git服务器上的myFirstRepo库

test123用户向git服务器管理(此处是之前的服务器本地的root用户)提交自己的ssh无密码公钥

管理员将test123的公钥复制到 gitolite-admin/keydir/ 下

# cp test123.pub /root/gitolite-admin/keydir/

管理员创建myFirstRepo库,并给test123分配权限

# cd gitolite-admin/conf/
# vim gitolite.conf

默认内容为:

repo gitolite-admin
    RW+ =   admin
repo testing
    RW+ =   @all

下边定义myFirstRepo库,并且指定用户权限:

repo gitolite-admin
    RW+ =   admin
repo testing
    RW+ =   @all
@myGroup=admin  test123
repo myFirstRepo
    RW+ =   @myGroup

注:此处@myGroup是一个组,给myGroup组赋予对myFirstRepo这个库的读、写、推送的权限(详细规则可参考gitolite的readme.txt)

管理员将对gitolite-admin的修改(建库、加用户)提交到git服务器

# pwd
/root/gitolite-admin
# git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   conf/gitolite.conf
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       keydir/test123.pub
no changes added to commit (use "git add" and/or "git commit -a")

# git add *
# git commit -m "AddRepo:myFirstRepo;AddUser:test123"
[master 4c5a5d0] AddRepo:myFirstRepo;AddUser:test123
Committer: root <root@app-node-V-CC.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
    git config --global user.name "Your Name"
    git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
    git commit --amend --author='Your Name <you@example.com>'
2 files changed, 6 insertions(+), 0 deletions(-)
create mode 100644 keydir/test123.pub

注:提示是建议设置用户信息(便于多人协作时辨别),可参照提示命令操作(其实git自动为你添加了)

# git push origin master
Counting objects: 10, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 859 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)
remote: Initialized empty Git repository in /home/git/repositories/myFirstRepo.git/
To git@192.168.213.130:gitolite-admin
48a7307..4c5a5d0  master -> master

客户验证

test123用户克隆myFirstRepo库

$ git clone git@192.168.213.130:myFirstRepo
Initialized empty Git repository in /home/test123/myFirstRepo/.git/
warning: You appear to have cloned an empty repository.
$ ls
myFirstRepo

test123用户初始化myFirstRepo库

$ touch test.sh
$ git add test.sh
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   test.sh
#
$ git commit -m "InitRepo:myFirstRepo"
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 224 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@192.168.213.130:myFirstRepo
* [new branch]      master -> master

SSH非22端口通信

本地或gitolite服务器使用非ssh默认端口,会出现错误,可通过下列方法解决:

$ vim ~/.ssh/config

添加 如下内容

host ${ip_of_gitolite_server}
port ${port_of_yours}

ubuntu12.04上安装gitolite,照猫画虎就行

转载于:https://my.oschina.net/u/818147/blog/170566

CentOS6.*安装gitolite相关推荐

  1. 实战centos6安装zabbix-2.4版(终极版)

    ###centos6安装zabbix-2.4版## #官方zabbix2.4安装手册:https://www.zabbix.com/documentation/2.4/manual #官方zabbix ...

  2. CentOS6 安装并破解Jira 7

    CentOS6 安装并破解Jira 7 JIRA软件是为您的软件团队的每个成员构建的,用来规划,跟踪和发布优秀的软件. https://confluence.atlassian.com/adminji ...

  3. 史上最详细版Centos6安装详细教程

    镜像CentOS-6.8-x86_64-bin-DVD1.ISO 将下载好的镜像上传到服务器,并选择该镜像(详情请看上篇exsi镜像上传文章) 一.安装开始 开机选择第一项 这里询问我们是否要对光盘进 ...

  4. CentOS6安装devtoolset(使用高版本gcc)GCC 4.8 GCC 4.9 GCC 5.2

    CentOS6安装devtoolset(使用高版本gcc)GCC 4.8 GCC 4.9 GCC 5.2 Aria2要求gcc 4.8以上的版本才能编译,然而CentOS6源里的gcc版本才4.4 G ...

  5. centos6 安装 mantisbt-1.2.8 —— (4)在CentOS6.4中安装配置LAMP环境

    一.修改设置对安装做准备 1 1. 防火墙设置 2 2. 关闭SELINUX 3 二.开始安装软件 4 1. MySql的安装和配置 4 2. Apache服务的安装和配置 8 3.安装PHP 10 ...

  6. centos6 安装 mantisbt-1.2.8 —— (3)Linux系统下yum源配置(Centos 6)

    Linux系统下yum源的配置(阿里云): 1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.ba ...

  7. centos6 安装 mantisbt-1.2.8 —— (2)【linux】VMware安装CentOS 6.4

    安装前准备:虚拟机.linux操作系统 下载好的Centos镜像(CentOS-6.4-x86_64-bin-DVD1) 链接:https://pan.baidu.com/s/1p3edXzUILTH ...

  8. centos6 安装 mantisbt-1.2.8 —— (1) VMware Workstation 12 Pro 虚拟机安装步骤详解(window 10 系统)

    对于目前主流之一的VMware 虚拟机而言,一直是各位小伙伴的首选,而VMware 12 Pro 是截止目前最新的VMware Workstation 版本:偶在这里特地给刚刚入坑的小伙伴详细介绍介绍 ...

  9. Centos6安装zabbix2.4初始化部署

    ##腾讯云实验室Centos6安装zabbix2.4## #说明:腾讯云实验室的yum源提供的是zabbix2.4版的安装包. #关闭防火墙和selinux systemctl  stop  fire ...

最新文章

  1. oracle导入备份失败怎么办,ORACLE 数据备份、恢复以及导入时表空间不存在的解决方案...
  2. 如何用Swift实现一个好玩的弹性动画
  3. 启动R环境并执行R脚本
  4. Linux--线程编程
  5. VTK:可视化算法之FilledContours
  6. Centos 安装配置 vsftpd
  7. 重要的ui组件——Behavior
  8. nssl1259-sequence【组合数,差分】
  9. linux设置免密ssh,Linux终端设置免密登陆ssh(以 XShell 为例)
  10. MyCat分布式数据库集群架构工作笔记0005---Mycat的安装
  11. (C#)xml的简单理解创建和读取
  12. featuretools,可自动构造机器学习特征的Python库
  13. c++之对vector排序并获得其索引
  14. 音频插件使用(wavesurfer.js)
  15. K60学习笔记(三)——K60各模块概述
  16. Windows7安装教程
  17. App第三方支付那些坑
  18. 【案例】电影数据分析
  19. 大数据——何谓“大”
  20. 用halcon提取衣服徽章

热门文章

  1. ios 折线图_《解神者》ios和安卓互通吗 ios和安卓互通分析
  2. python 守护线程 join_Python多线程threading join和守护线程setDeamon原理详解
  3. 服务器维护日常需做哪些工作?
  4. linux shell unlink,linux shell中,unlink和rm命令有什么区别
  5. oracle修改c root,从新发现Oracle太美之root.sh
  6. oracle rac应急_Support for Oracle RAC 框架资源组故障
  7. 图论 ---- E. Bear and Forgotten Tree 2(判补图的联通性技巧 图遍历的优化 条件拆分)
  8. c语言printf 空格,在打印输出前面添加空格,如在C中[printf(%2i)]
  9. luogu P3398 仓鼠找sugar(树链剖分、求树上两条路径有没有交点,爽!)
  10. 洛谷专题训练 ——【算法1-1】模拟与高精度