环境:

系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡)

系统版本:CentOS-7.0-1406-x86_64-DVD.iso

服务器IP:192.168.1.31 域名:www.domain.com SSH端口:8200(默认为22)

安装步骤:

1.显示服务器版本
[root@tCentos7 ~]# cat /etc/redhat-release
#CentOS Linux release 7.0.1406 (Core)

[root@tCentos7 ~]# uname -a
#Linux tCentos7 3.10.0-123.9.3.el7.x86_64 #1 SMP Thu Nov 6 15:06:03 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[root@tCentos7 ~]# ifconfig
#服务器IP192.168.1.31

2.安装git

#2.1 下载git-2.2.0.tar.gz 到 /usr/local/src

[root@tCentos7 ~]# cd /usr/local/src

[root@tCentos7 ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.2.0.tar.gz

#2.2 安装依赖的库

[root@tCentos7 ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel

#2.3 删除原本的安装的git

[root@tCentos7 ~]# yum remove git -y

#2.4 编译安装
[root@tCentos7 ~]# cd /usr/local/src

[root@tCentos7 ~]# tar -zvxf git-2.2.0.tar.gz

[root@tCentos7 ~]# cd git-2.2.0

[root@tCentos7 ~]# make prefix=/usr/local/git all

[root@tCentos7 ~]# make prefix=/usr/local/git install

#2.5 增加软连接

[root@tCentos7 ~]# ln -s /usr/local/git/bin/* /usr/bin/

[root@tCentos7 ~]# git --version

#如何能显示版本号,即表示成功

3.安装gitosis
[root@tCentos7 ~]# yum install python python-setuptools

[root@tCentos7 ~]# cd /usr/local/src

[root@tCentos7 ~]# git clone git://github.com/res0nat0r/gitosis.git

[root@tCentos7 ~]# cd gitosis

[root@tCentos7 ~]# python setup.py install

#显示Finished processing dependencies for gitosis==0.2即表示成功

*******************************************************

4.修改客户端git连接端口(如果GIT服务器为默认SSH端口为22,则不需要以下步骤)

#修改开发机客户端配置文件(可以省略每次输入端口)

[root@tCentos7 ~]# mkdir  ~/.ssh

[root@tCentos7 ~]# vim ~/.ssh/config

#打开后,编辑文件,添加以下代码
host www.domain.com
hostname www.domain.com
port 8200

#修改后,开发机客户端即可用以下方式进行连接访问
#git clone ssh://git@www.domain.com/gitosis-admin.git

#否则需要需要加上端口进行访问

#git clone ssh://git@www.domain.com:8200/gitosis-admin.git
*******************************************************

5.在开发机客户端上,生成密钥并上传到服务器上

ssh-keygen -t rsa
#一路回车,不需要设置密码

#从开发机客户端,上传刚生成的公钥到服务器(如果修改端口,按4进行配置指定端口)
scp ~/.ssh/id_rsa.pub root@www.domain.com:/tmp/

#显示已经上传的密钥

[root@tCentos7 ~]# ls /tmp/id_rsa.pub

6.服务器上生成git用户,使用git用户并初始化gitosis

#6.1 增加git用户

[root@tCentos7 ~]# adduser -m git

#6.2切换用户
[root@tCentos7 ~]# su - git

#6.3 服务器的公钥(刚才开发机客户端上传),导入后此开发机客户端即可以管理git服务器。

[root@tCentos7 ~]# gitosis-init < /tmp/id_rsa.pub

#显示以上信息即表示成功
#Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
#Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/

#6.4 删除密钥
[root@tCentos7 ~]# su - root
[root@tCentos7 ~]# rm -rf /tmp/id_rsa.pub

6.在开发机客户端,复制git管理项目(git服务器管理,也是一个git仓库)
mkdir -p /repo
cd /repo
git clone git@www.domain.com:gitosis-admin.git

7.在开发机客户端,增加及设置管理项目
cd /repo/gitosis-admin

#查看已经上传密钥
ls keydir
cat keydir/vicowong\@VICO.pub #vicowong@VICO.pub为已经上传的开发机生成的公密

#显示密钥最后的符串为密钥用户名 这里为vicowong@VICO

vim gitosis.conf

#在文件尾增加以下内容
[group test-git] # 组名称
writable = test-git # 项目名称
members = vicowong@VICO #密钥用户名

#提交修改
git add .
git commit -a -m "add test-git repo"
git push

9.在开发机客户端,初始,增加及使用项目test-git
cd /repo
mkdir test-git
cd test-git
git inti
touch readme
git add .
git commit -a -m "init test-git"
git remote add origin git@www.domain.com:test-git.git
git push origin master

CentOS7 编译安装 Git 服务器 Centos 7.0 + Git 2.2.0 + gitosis (实测 笔记)的更多相关文章

  1. CentOS安装Git服务器 Centos 6.5 + Git 1.7.1.0 + gitosis

    1.安装扩展 yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel 2.下载git ...

  2. Centos7编译安装Xen环境(vtpm)

    编译xen环境(http://www.lvtao.net/server/574.html#comment-1882): yum update yum groupinstall "Develo ...

  3. centos7 编译安装新版LNMP环境

    centos7 编译安装新版LNMP环境 环境版本如下: 1.系统环境:Centos 7 x86_64 2.NGINX:nginx-1.11.3.tar.gz 3.数据库:mariadb-10.0.2 ...

  4. CentOS7编译安装Nginx-1.8.1和编译参数

    CentOS7编译安装Nginx-1.8.1和编译参数 Web服务器Nginx    LNMP是一组众所周知的Web网站服务器架构环境,即由Linux+Nginx+MySQL+PHP(MySQL有时也 ...

  5. centos7编译安装MySQL5.7.9

    title: centos7编译安装MySQL5.7.9 date: 2016-05-12 16:20:17 tags: --- Centos7编译安装mysql5.7.9 mysql5.7有更好的性 ...

  6. CentOS7编译安装httpd-2.4.41 php7.3

    CentOS7编译安装httpd-2.4.41 php7.3 安装参考环境: CentOS Linux release 7.5.1804 (Core) 一.安装依赖包 httpd安装的依赖包 # yu ...

  7. shopnc编译安装IM服务器node.js

    编译安装IM服务器node.js下载地址http://www.nodejs.org/download/ 选择Source Code node-v0.12.0 #  ./configure # make ...

  8. Windows 编译安装 nginx 服务器 + rtmp 模块

    有关博客: <Windows 编译安装 nginx 服务器 + rtmp 模块>.<Ubuntu 编译安装 nginx>.<Arm-Linux 移植 Nginx> ...

  9. Centos7 编译安装PHP7

    Centos7 编译安装PHP7 编译安装的方式可以让组件等设置更加合理,但需要你对PHP的代码及各种配置非常的熟悉,以下为大致的安装流程,大家可以参考 1.下载编译工具 yum groupinsta ...

  10. CentOS7编译安装php7.1配置教程详解

    这篇文章主要介绍CentOS7编译安装php7.1的过程和配置详解,亲测 ,需要的朋友可以参考. 1.首先安装依赖包: yum install libxml2 libxml2-devel openss ...

随机推荐

  1. Atom安装以及activate-power-mode atom package插件安装

    1.首先安装node.js,不然没有npm命令可用. 现在很多开源程序都使用npm来管理依赖包,所以node.js必备呀. 2.去下载atom安装包和activate-power-mode-0.5.2 ...

  2. 响应者链条,如何获取最佳的点击view 以及内部实现

    事件的产生与传递 事件是如何产生与传递的? 当发生触摸事件后,系统会将该事件加入到一个由UIApplication管理的事件队列中. UIApplication会从时间队列中取出最前面的时间,并将事件 ...

  3. lua相关笔记

    --[[ xpcall( 调用函数, 错误捕获函数 ); lua提供了xpcall来捕获异常 xpcall接受两个参数:调用函数.错误处理函数. 当错误发生时,Lua会在栈释放以前调用错误处理函数,因 ...

  4. 【转】PHP的Trait 特性

    Trait是在PHP5.4中加入的,它既不是接口也不是类.主要是为了解决单继承语言的限制.是PHP多重继承的一种解决方案.例如,需要同时继承两个 Abstract Class, 这将会是件很麻烦的事情 ...

  5. Codeigniter基础

    一.去除index.php 新建.htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUES ...

  6. 【Java EE 学习 74 下】【数据采集系统第六天】【使用Jfreechart的统计图实现】【将JFreechart整合到项目中】

    之前说了JFreechart的基本使用方法,包括生成饼图.柱状统计图和折线统计图的方法.现在需要将其整合到数据采集系统中根据调查结果生成三种不同的统计图. 一.统计模型的分析和设计 实现统计图显示的流 ...

  7. RHEL6.5安装11.2.0.3 RAC并打补丁

    [TOC] 一,主机配置 1.修改hosts文件(两节点) #127.0.0.1 localhost localhost.localdomain localhost4 localhost4.local ...

  8. C#语言实现定时开启或禁用网卡小程序

    C#语言实现定时开启/禁用网卡 程序运行效果图 程序实现主要代码 源代码工程文件(VS2013工程文件编译通过) 查看网卡名称附图 1.win7旗舰版运行效果图: 2.程序实现主要代码: /// 网卡 ...

  9. 在Asp.Net MVC 中如何用JS访问Web.Config中appSettings的值

    应用场景: 很多时候我们要在Web.Config中添加appSettings的键值对来标识一些全局的信息,比如:调用service的domain,跳转其他网站页面的url 等等: 那么此时就涉及到了一 ...

  10. maven打包时,依赖包打不进jar包中

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...