服务器怎么安装http协议,搭建(基于http协议)git服务器的安装配置说明

111.png

搭建(基于http协议)git服务器的安装配置说明

一、软件运行环境:

服务器版本:CentOS 5.10 (Final) Apache版本:Apache-2.2.3 git 版本: git-1.8.2.3

git访问方式:基于http协议(非ssh协议) 客户端版本 :winxp/win7/win8

Eclipse版本: Version: Luna Service Release 1 (4.4.1)

二、搭建(基于http协议)git服务器的安装配置说明:

1、安装Apache

[root@www wlj]# yum install httpd

2、安装git

[root@www wlj]# yum install git

3、安装gitweb

[root@www wlj]# yum install gitweb

4、创建一个git用户,用来运行git服务 [root@www wlj]# /usr/sbin/useradd git

5、初始化git仓库:这里我们选择/home/git/sample.git来作为我们的git仓库 [root@lwww git]# git init --bare sample.git 出现以下提示:

Initialized empty Git repository in /home/git/ sample.git / #sample.git是个文件夹

6. 修改sample.git的所有者与所属群组。 cd /home/git/sample.git

chown -R apache:apache .#所有者与所属群组都是apache

7、 Gitweb的配置 Vi /etc/gitweb.conf

$projectroot = \

8、创建git.conf文件夹

mkdir /etc/httpd/conf/vhost

9、创建用于git用户验证的帐户(可以是多个)

htpasswd -m -c /etc/httpd/conf/vhost/git.passwd zfz #zfz是用户名

10、修改git.passwd文件的所有者与所属群组

chown apache:apache /etc/httpd/conf/vhost/git.passwd #所有者与所属群组都是apache

11、 设置git.passwd文件的访问权限

chmod 640 /etc/httpd/conf/vhost/git.passwd

12. 修改apache配置文件httpd.conf vi /etc/httpd/conf/httpd.conf #添加如下的内容:

ServerName 192.168.71.187

include conf/vhost/*.conf #说明:

#ServerName是git服务器的域名或IP

13、 Git的配置

Vi /etc/httpd/conf/vhost/git.conf

SetEnv GIT_PROJECT_ROOT /home/git/ SetEnv GIT_HTTP_EXPORT_ALL

ScriptAlias / /usr/bin/git-http-backend/ DAV on

Order allow,deny Allow from all AuthType Basic

AuthName \

AuthUserFile /etc/httpd/conf/vhost/git.passwd Require valid-user #说明:

#/home/git是代码库存放的文件夹

#ScriptAlias是将以/ sample.git作为repository. path # AuthUserFile是验证用户帐户的文件

14、 重启apache使设置生效 service httpd restart

三、使用Eclipse 测试git服务器如下:

1.新建一个java项目

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值