一、服务器端安装

git支持四种传输协议

1.本地协议

2.ssh协议

3.git协议

4.http/s协议

[root@zabbix ~]# cat /etc/redhat-release
CentOS Linux release  (Core)
[root@zabbix ~]# uname -r
-.el7.x86_64
[root@zabbix ~]# rpm -qa git
git-.el7.x86_64
[root@zabbix ~]# yum remove git
[root@zabbix ~]# yum install gcc gcc-c++ -y

[root@zabbix ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel  perl-ExtUtils-MakeMaker -y

[root@zabbix ~]# mkdir -p /server/tools
[root@zabbix ~]# cd /server/tools/
[root@zabbix tools]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz
[root@zabbix tools]# tar xf git-2.9.0.tar.gz
[root@zabbix tools]# cd git-2.9.0
[root@zabbix git-2.9.0]# make prefix=/application/git
[root@zabbix git-2.9.0]# make prefix=/application/git install
[root@zabbix git]# echo 'export PATH=/application/git/bin:$PATH' >>/etc/profile
[root@zabbix git]# source /etc/profile
[root@zabbix bin]# git --version
git version 2.9.0######测试以原来的git客户端,作为服务器端,这里将原有的仓库,导出为裸仓库,如果是客户端,导为裸仓库后,转移到服务器端即可[root@zabbix data]# ls      test            #####test为现有仓库[root@zabbix data]# ls -a test/.  ..  1  2  3  4  .git[root@zabbix data]# git clone --bare test test.git      #####将现有仓库导出为裸仓库----即不包含工作目录的仓库克隆到纯仓库 'test.git'...完成。[root@zabbix data]# ls -a test.git/          #####裸仓库内容.  ..  branches  config  description  HEAD  hooks  info  objects  packed-refs  refs[root@zabbix data]# mkdir 111[root@zabbix data]# git clone /data/test.gitfatal: 目标路径 'test' 已经存在,并且不是一个空目录。[root@zabbix data]# cd 111[root@zabbix 111]# git clone /data/test.git    #####测试,新建一个目录,克隆刚刚导出的裸仓库,与原来仓库的内容相同正克隆到 'test'...完成。[root@zabbix 111]# ll test/ -a总用量 0drwxr-xr-x. 3 root root  54 6月  27 16:02 .drwxr-xr-x. 3 root root  18 6月  27 16:02 ..-rw-r--r--. 1 root root   0 6月  27 16:02 1-rw-r--r--. 1 root root   0 6月  27 16:02 2-rw-r--r--. 1 root root   0 6月  27 16:02 3-rw-r--r--. 1 root root   0 6月  27 16:02 4drwxr-xr-x. 8 root root 163 6月  27 16:02 .git

######使用ssh协议客户端[root@zabbixclient ~]# ssh-keygen Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'.Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:5c:a1:ed:50:8c:da:05:43:8e:d6:5d:08:95:5d:c2:4f root@zabbixclient.suffergtf.comThe key's randomart image is:+--[ RSA 2048]----+|       .=*+=o..  ||       +.*=oo.E  ||      oo=.+  o   ||     ....+    .  ||        S .      ||                 ||                 ||                 ||                 |+-----------------+[root@zabbixclient ~]# ssh-copy-id root@192.168.127.250The authenticity of host '192.168.127.250 (192.168.127.250)' can't be established.ECDSA key fingerprint is e5:07:2a:f0:9f:c5:df:64:70:61:6a:7a:31:bf:21:7a.Are you sure you want to continue connecting (yes/no)? /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installedThe authenticity of host '192.168.127.250 (192.168.127.250)' can't be established.ECDSA key fingerprint is e5:07:2a:f0:9f:c5:df:64:70:61:6a:7a:31:bf:21:7a.Are you sure you want to continue connecting (yes/no)? yes/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysroot@192.168.127.250's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.127.250'"and check to make sure that only the key(s) you wanted were added.

[root@zabbixclient ~]# ssh root@192.168.127.250      ####免密码登陆Last login: Mon Jul  9 15:21:26 2018 from 192.168.127.251

[root@zabbixclient data]# git clone root@192.168.127.250:/data/test.git      ####克隆远程仓库正克隆到 'test'...remote: Counting objects: 16, done.remote: Compressing objects: 100% (12/12), done.remote: Total 16 (delta 6), reused 0 (delta 0)接收对象中: 100% (16/16), done.处理 delta 中: 100% (6/6), done.[root@zabbixclient data]# lstest[root@zabbixclient data]# cd test[root@zabbixclient test]# git status# 位于分支 master无文件要提交,干净的工作区

git服务器端安装的更多相关文章

  1. window下版本控制工具Git 客户端安装

    安装使用 1.下载msysgit http://code.google.com/p/msysgit/ 2.下载tortoisegit客户端安装 http://code.google.com/p/tor ...

  2. 分布式版本控制系统Git的安装及使用

    Git的安装分为客户端安装和服务端安装,鉴于我平时码代码在windows环境下,因此本文客户端安装直接在windows环境,服务端安装在linux环境下(centos). Git客户端安装 客户端下载 ...

  3. git教程——安装配置

    Git(读音为/gɪt/.)是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理. Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个 ...

  4. centos7下git服务器端搭建

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  5. git从安装到使用

    一.Git简介 Git是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制 ...

  6. centos7下git服务器端搭建(转)

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  7. eclipse的git插件安装、配置与使用

    Git是一个分布式的版本控制工具,本篇文章从介绍Git开始,重点在于介绍Git的基本命令和使用技巧,让你尝试使用Git的同时,体验到原来一个版 本控制工具可以对开发产生如此之多的影响,文章分为两部分, ...

  8. centos7下git的安装和配置

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  9. 1.windows下GIT 服务安装

    本章介绍简单在windows 安装git 服务方法.服务器端采用的是Bonobo Git Server,一款用ASP.NET MVC开发的Git源代码管理工具,界面简洁,基于Web方式配置,简单易用. ...

随机推荐

  1. bzoj3195: [Jxoi2012]奇怪的道路(状压dp)

    Description 小宇从历史书上了解到一个古老的文明.这个文明在各个方面高度发达,交通方面也不例外.考古学家已经知道,这个文明在全盛时期有n座城市,编号为1..n.m条道路连接在这些城市之间,每 ...

  2. EOS:dfuse stream 保证不会错过一个心跳

    强大的 dfuse history API 给我们带来了高效的链数据获取途径,让我们的 dapp 在用户体验上了一个台阶. 官方示例 不会错过一个心跳 代码分析 函数 pendingActions 待 ...

  3. P1251 递推专练3

    递推专练3 描述 Description 圆周上有N个点.连接任意多条(可能是0条)不相交的弦(共用端点也算相交)共有多少种方案? 输入格式 Input Format 读入一个数N.<=N< ...

  4. C#操作高低位

    比如一个数 想把高位 与地位拆开,分别显示 可以用这个办法 x=(uint16)(x>>8)   (高字节向右移动8位 相当于*256) X=(UINT16)(X &0X00FF) ...

  5. C++11六大函数(构造函数,移动构造函数,移动赋值操作符,复制构造函数,赋值操作符,析构函数)

    在C++中,有三大函数复制控制(复制构造函数,赋值操作符,析构函数),而在C++11中,加入了移动构造函数,移动赋值操作符.我就斗胆将他们命名为六大函数好了. 一.构造函数 c++primer中说过: ...

  6. charles之抓包和断点

    一 .charles抓包 Charles抓包很简单,只要手机设置代理即可,不会的也可以去百度. 在这里是要记录抓包过程中win10遇到的问题,手机代理设置没问题但是就是抓不到包的情况 1.关闭防火墙 ...

  7. queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards

    题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...

  8. magento package

    Magento Local module file is relative to app/code/local/ Magento Community module file is relative t ...

  9. 初探Hibernate3源码--读取配置文件

    依照个人推测,要实现ORM框架,关键是如何拼凑sql语句再通过jdbc来进行对数据库的访问,另外将数据库返回的数据记录封装成对应的类也是必不可少的. 那么实现ORM框架的基本思路如下: 1,读取xml ...

  10. string类常用方法3