http://www.kankanews.com/ICkengine/archives/64748.shtml

2人收藏此文章,





发表于4小时前(2013-10-22 16:12) ,

已有26次阅读 ,共1个评论

安装基础包

# 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 ${post_of_yours}

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

声明:OSCHINA 博客文章版权属于作者,受法律保护。未经作者同意不得转载。

CentOS6.*安装gitolite的更多相关文章

  1. 安装gitolite,并ssh公钥无密码登录

    安装gitolite,并ssh公钥无密码登录 gitolite是管理git版本库的一种方案,它将git版本库的管理信息放在了一个特殊git版本库里.gitolite与linux操作系统集成了,需要使用 ...

  2. Centos6 安装vnc

    Centos6 安装vnc 1. 安装 使用yum方式安装 yum install tigervnc-server tigervnc #启动 vncserver #重启动 /etc/init.d/vn ...

  3. centos6 安装vsftpd

    centos6 安装vsftpd vsftpd一般选择yum安装,以下是安装和配置过程 如果是centos6想要安装的话一般是编译安装 1.安装 yum安装 yum install vsftpd 编译 ...

  4. oracle 11g centos6 安装

    选型:32位的内存是个瓶颈,已经是64位的时代了.使用64位的CentOS6 和 64位的Oracle 11g R2在虚拟机器安装,采用hostonly方式设置网络注意:能上网的网卡要设置一下ICS( ...

  5. CentOS6 安装Sendmail + Dovecot + Roundcubemail

    前言 本文是继CentOS6 安装Sendmail + Dovecot + Squirrelmail 关于邮箱服务器配置的第二篇文章,因为关于使用Sendmail进行相关配置的文章.资料等太老,而且资 ...

  6. centos6 安装配置ss笔记

    2018-05-17 centos6 安装配置ss笔记 操作环境:Centos 6 x86_64 bbr 服务器地址:美国 1.准备VPS 在https://www.bwh1.net可购买,购买时已默 ...

  7. Centos6安装Percona-tools工具

    Centos6安装Percona-tools工具 环境:centos6.x yum -y install perl-DBI yum -y install perl-DBD-MySQL yum -y i ...

  8. Centos6安装FreeSWITCH 1.5时./configure问题解决记录

    系统:Centos 6.4 64位: FreeSWITCH版本:1.5 具体的安装过程参考FreeSWITCH 官网wiki (也可以参考我的博客<Centos6安装FreeSWITCH> ...

  9. CentOS6 安装并破解Jira 7

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

随机推荐

  1. 链路层 - SLIP,PPP,

    最常使用的封装格式是RFC 894定义的格式.图2 - 1显示了两种不同形式的封装格式.图中每个方框下面的数字是它们的字节长度. 两种帧格式都采用48 bit(6字节)的目的地址和源地址( 8 0 2 ...

  2. Xcode 下删除Provisioning Profiles文件

    Xcode 中有很多不可以用的Provisioning Profiles 文件,每次选择手机证书时,看着那么长的菜单很烦有木有? 在Xcode 5中删除 Provisioning Profiles,打 ...

  3. Oracle Global Finanicals Technical Reference(二)

    Skip Headers Oracle Global Finanicals Oracle Global Financials Technical Reference Manual Release 11 ...

  4. rails4 new没有生成prototype.js之类的脚本解决办法

    早期版本的rails在新生成程序时会在/public/javascript目录中自动放入若干个js脚本.不过在rails4.2.0中无论是否加-j选项,都不会生成这些脚本文件了.解决办法是安装prot ...

  5. C# 如何合并Excel工作表

    文档合并.拆分是实现文档管理的一种有效方式.在工作中,我们可能会遇到需要将多个文档合并的情况,那如何来实现呢,本文将进一步介绍.关于拆分Excel工作表,可参见这篇文章--C#如何拆分EXCEL工作表 ...

  6. 听晴明老师从头讲React Native 百度云下载 百度网盘

    适用人群 能使用至少一门主流编程语言:有基本的面向对象的概念:最好有一些web相关的知识和概念. 课程概述 新颖.实用.详尽的ReactNative零基础课程,由国内权威的ReactNative中文网 ...

  7. jquery-取消冒泡

    1.通过返回false来取消默认的行为并阻止事件起泡. jQuery 代码: $("form").bind( "submit", function() { re ...

  8. java中内存的使用

    一个java运行起来执行代码,主要的内存消耗有这几块: 1.堆 2.栈 :栈是每个线程一个的,是以消耗的内存是内存大小*线程数,当线程数特多时候需要小心 . 3.直接内存:主要是通道时候的缓存,在内存 ...

  9. Linux的chkconfig命令详解

    chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接. 使用语法: chkconfig [--a ...

  10. Windows上模拟Linux环境的软件Cygwin

    Windows上模拟Linux环境的软件Cygwin 2010-10-11 15:19      我要评论(0) 字号:T|T Cygwin是一个用于在Windows上 模拟Linux环境的软件.它可 ...