环境:

系统硬件: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. Demo中的IOC自定义实现

    在做练习的时候,小小项目,使用IOC控件觉得麻烦,使用工厂觉得不高大上啊,自己写个简陋的依赖注入IOC吧; 控制反转(IOC)是管理映射依赖的的,是依赖倒置(DIP)的实现方式; 依赖倒置(DIP)是 ...

  2. 【python】安装指定模块

    使用pip 1.卸载模块 sudo pip uninstall xxx 2.安装指定版本模块 sudo pip install xxx==2.0.1.3

  3. C# 类使用小demo

    太晚了,不说了,直接上图 运行结果

  4. MFC 文件夹选择对话框

    CString setSavePath() { CString strPath = _T(""); HRESULT hr; LPITEMIDLIST pItemList; BROW ...

  5. 分享一个常用Adb命令

    分享一个常用Adb命令 首先 首先感谢@xuxu的常用adb命令,收益良多,但是已经不能满足于我,所以补充了下. 再者 好久没发帖了,最近论坛老司机们都在讨论/总结,我就用这个干货回报吧. 最后 基于 ...

  6. MysqlNDB集群配置

    为了避免不必要的资源分配,默认情况下是不启动ndbcluster引擎.

  7. Docker(一)

    Docker是一个能够把开发的应用程序自动部署到容器的开源引擎,它基于Apache2.0开源授权协议发行,以Docker容器为资源分割和调度的基本单位,封装整个软件运行时环境,为开发者和管理员设计的, ...

  8. mvc学习中的问题汇总

    问题1:更新条目时出错.有关详细信息,请参阅内部异常. 初学MVC,正好手上有别人搭建的一个框架.于是直接用了起来.一切似乎都很顺利. 列表页也正常读取了.可是在新增数据时,始终报如上的错.即使用了调 ...

  9. wamp2.5 配置多端口虚拟主机

    1.保证httpd.conf下 Include conf/extra/httpd-vhosts.conf LoadModule php5_module "D:/E/php/wamp/bin/ ...

  10. XML 特殊字符

    XML转义字符 以下为XML标志符的数字和字符串转义符 "     (" 或 ") '     (' 或 &apos;) &     (& 或 & ...