环境:

系统硬件: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. tornado 异步调用系统命令和非阻塞线程池

    项目中异步调用 ping 和 nmap 实现对目标 ip 和所在网关的探测 Subprocess.STREAM 不用担心进程返回数据过大造成的死锁, Subprocess.PIPE 会有这个问题. i ...

  2. Sass 的调试

    Sass 的调试 Sass 调试一直以来都是一件头痛的事情,使用 Sass 的同学都希望能在浏览器中直接调试 Sass 文件,能找到对应的行数.值得庆幸的是,现在实现并不是一件难事,只要你的浏览器支持 ...

  3. js下载项目中的文件

    项目中有一个连接是下载视频插件,放到服务器上,不能io输出,所以指定地址直接下载 <div id="objInfo"> <jsp:include page=&qu ...

  4. JSP复习整理(三)基本语法续

    查看注册后的信息: TestBean.java package com.hai.xaio.cn; public class TestBean { public String userName; pub ...

  5. iOS UIAlertController跟AlertView用法一样 && otherButtonTitles:(nullable NSString *)otherButtonTitles, ... 写法

    今天写弹出框UIAlertController,用alertView习惯了,所以封装了一下,跟alertView用法一样,不说了,直接上代码: 先来了解一下otherButtonTitles:(nul ...

  6. 【ajax 提交表单】多种方式的注意事项

    在业务中,可能因为表单内容过于庞大,字段过于繁杂,如果人为去拼接的话 ,需要耗费大量的时间和精力,与此同时,代码看上去也是冗余不堪. 所以,提交表单的时候如果能整个表单数据整体提交,那是非常开心的事情 ...

  7. Go语言 Cookie的使用

    首先看看Cookie的结构体 type Cookie struct { Name string Value string Path string // optional Domain string / ...

  8. GIT版本管理工具

    原文:http://blog.csdn.net/ithomer/article/details/7527877 Git 是一个分布式版本控制工具,它的作者 Linus Torvalds 是这样给我们介 ...

  9. Codeforces Round #388 (Div. 2) - B

    题目链接:http://codeforces.com/contest/749/problem/B 题意:给定平行四边形的3个点,输出所有可能的第四个点. 思路:枚举任意两个点形成的直线,然后利用这两个 ...

  10. ASP.NET中GridView数据导出到Excel

    /// <summary> /// 导出按钮 /// </summary> /// <param name="sender"></para ...