您好,欢迎访问这里是深圳市硕远科技有限公司!
戴尔服务器价格_IBM联想配置_浪潮代理-深圳市硕远科技有限公司
联系我们
戴尔服务器价格_IBM联想配置_浪潮代理-深圳市硕远科技有限公司
邮箱:2324898850@qq.com
电话:400-080-6079
地址:深圳市龙华区河背工业区108创业园A301
当前位置:主页 > 新闻动态 > 行业新闻 >

行业新闻

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

发布时间:2021-10-13 18:01:14浏览次数:
搭建(基于 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 = "/home/git/"; 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 "Git" 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 项目 点击上图 Java Project 后出现以下界面 点击上图 Finish 后出现以下界面 2 、建立本地 git 仓库 点击上图 Share Project 后出现以下界面
400-080-6079