Centos6.8搭建Git服务(git版本可选)
搭建Git服务器需要准备一台运行Linux的机器,本文以Centos6.8纯净版系统为例搭建自己的Git服务。
准备工作:以root用户登陆自己的Linux服务器。
第一步安装依赖库
[root@localhost ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
[root@localhost ~]# yum install gcc perl-ExtUtils-MakeMaker
第二步卸载旧版git
加入原先有用yum安装过git,则需要先卸载一下
[root@localhost ~]# yum remove git
第三步下载源码
下载git-2.10.0.tar.gz 到 /usr/local/src
(查找git版本可以到https://www.kernel.org/pub/software/scm/git/下查看git的版本号自行选择下载)
查看版本方法:
[root@iZbp1ap7v4yegqdgzrh7cuZ ~]# wget -v https://www.kernel.org/pub/software/scm/git/
[root@iZbp1ap7v4yegqdgzrh7cuZ ~]# vi index.html
复制想下载的版本 --> Esc --> :q! --> 回车!
这里我选择下载git-2.10.0.tar.gz
[root@localhost ~]# cd /usr/local/src
[root@localhost ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.10.0.tar.gz
第四步解压、编译和安装
[root@localhost ~]# tar -zvxf git-2.10.0.tar.gz
[root@localhost ~]# cd git-2.10.0
[root@localhost ~]# make prefix=/usr/local/git all
[root@localhost ~]# make prefix=/usr/local/git install
第五步将git目录加入PATH
[root@localhost ~]# echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/bashrc
[root@localhost ~]# source /etc/bashrc
安装成功后就可以查看到git版本了。
[root@localhost ~]# git --version
git version 2.10.0
第六步创建git账号并设置密码
[root@localhost ~]# useradd -m git
[root@localhost ~]# passwd git
Changing password for user git.
New password:
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
第七步创建git仓库并初始化
[root@localhost ~]# mkdir -p /home/git/repositories/test.git
[root@localhost ~]# cd /home/git/repositories/test.git
[root@localhost test.git]# git --bare init
Initialized empty Git repository in /home/git/repositories/test.git/
第八步给git仓库目录设置用户和用户组并设置权限
[root@localhost test.git]# chown -R git:git /home/git/repositories
[root@localhost test.git]# chmod 755 /home/git/repositories
第九步限制git账号的ssh连接
查找git-shell所在目录
[root@localhost ~]# whereis git-shell
git-shell: /usr/src/git-2.10.0/git-shell
编辑passwd文件
[root@localhost ~]# vi /etc/passwd
找到这一行
git:x:500:500::/home/git:/bin/bash
将最后的/bin/bash改为:git-shell的目录 /usr/src/git-2.10.0/git-shell 如下:
git:x:500:500::/home/git:/usr/src/git-2.10.0/git-shell
Esc --> :wq! --> 回车!
完成搭建,去克隆提交试试吧!
clone地址:
ssh://git@服务器ip地址:端口/home/git/repositories/test.git
附加:以后每次新建仓库时,只需执行上面第七、八步即可!
Centos6.8搭建Git服务(git版本可选)的更多相关文章
- Centos6.9 搭建rsync服务端与客户端 案例:全网备份项目
rsync的企业工作场景说明 1)定时备份 1.1生产场景集群架构服务器备份方案项目 借助cron+rsync把所有客户服务器数据同步到备份服务器 2)实时复制 本地数据传输模式(local-only ...
- centos6.4搭建lnmp服务(转载)
1.配置防火墙,开启80端口.3306端口vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp --dport 8 ...
- 一文详解CentOS6.5搭建DNS服务
本文详细介绍DNS服务在Linux Operation System 中的搭建过程 一.DNS服务器的工作原理 客户机提出域名解析请求,并将该请求发送给本地的域名服务器.当本地的域名服务器收到请求后, ...
- Centos6.5搭建dhcpd服务
dhcpd动态获取ip地址,对于小型局域网很便利的.在不大的网络社会静态ip也是不错的! 环境 centos6.5 10.10.24.1 (dns-server) winxp sp3 (clie ...
- centos6.7搭建DHCP服务器
centos6.7搭建DHCP服务 2017-03-24 09:47:16 系统环境: centos6.7 安装之前首先使用rpm –qa | grep dhcp查看系统中是否已安装了dhcp软件包. ...
- Centos6.8/7.0搭建Git服务http访问方式
安装Git版本:git 2.10.0 Git访问方式:基于http的基本验证(非SSL) 1. 安装Apache软件: [root@localhost ~]# yum install httpd 设置 ...
- Git服务搭建及github使用教程
.pos { position: fixed; top: 35%; left: 90% } .pos a { border: 2px solid white; background: #99CCFF; ...
- centos上搭建git服务--2
在 Linux 下搭建 Git 服务器 环境: 服务器 CentOS6.6 + git(version 1.7.1)客户端 Windows10 + git(version 2.8.4.window ...
- 基于Gitea搭建属于自己的Git服务
作者:IT王小二 博客:https://itwxe.com 一.搭建环境和前提 搭建环境: 操作系统:CentOS7.6 Docker版本:docker-ce-18.09.9 Lsky Pro版本:1 ...
随机推荐
- 在linq to entities中无法使用自定义方法
来源: http://support.microsoft.com/kb/2588635/zh-tw (繁体)
- OpenVpn的ipp.txt文件
ipp=ip pool我猜得,呵呵 ipp.txt文件中存放上一次连接时,客户端分配的ip地址. ipp.txt用来保存上次的连接状态的,并不能为客户端设置固定ip地址. 该文件的格式为:用户名,ip ...
- [sh]ls -F一种非常有用的ls格式
ls -F一种非常有用的ls格式 tz/y/yupeng > ls -F#q# News/ doc/ images/ mbox ...
- 【Android】6.1 Toast(信息提示框)
分类:C#.Android.VS2015: 创建日期:2016-02-08 一.简介 Toast用于向用户显示一些帮助或者提示信息.前面我们已经多次用到它,这里只是系统地将其总结一下,并演示它的各种基 ...
- C++ string的用法
之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够.字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是 ...
- python __slots__使用详解
1.动态添加属性 class Lang(object): def __init__(self,name,score): self.name=name self.score=score def lang ...
- (转)iPhone开发关于UDID和UUID的一些理解
转自:http://www.cocoachina.com/bbs/read.php?tid=92404另外配合参考这里:https://github.com/ymsheng/ios-deviceUni ...
- LeetCode: Multiply Strings 解题报告
Multiply StringsGiven two numbers represented as strings, return multiplication of the numbers as a ...
- spring 在service中需要抛出异常才能自动回滚
在spring 事务配置中,如果service方法捕获了异常,则程序报错也不会自动回滚, 1.手动开启关闭事务 2.抛出异常,可以先捕获异常,然后自定义runtime异常,可不用声明
- javascript publish/subscribe or observer pattern
定义 定义一对多的对象封装,目标对象状态发生变化,它所有的接受者都会收到通知并做相应的更新. 使用频率:5/5 最高 概要 观察者模式,也就是发布者/订阅者模式,当发布者发布一个通知的时候,订阅者就 ...