zoukankan      html  css  js  c++  java
  • Ubuntu 安装 gitweb + Apache2

    背景

    之前已经使用了gerrit进行代码管理,但是在有些代码由于内部技术管理不当而丢失了Review记录。

    因此找到了通过gitweb弥补的问题。

    做法

    安装

    sudo apt-get install -y gitweb apache2
    

    修改gitweb配置

    vim /etc/gitweb.conf
    

    基本上只修改如下内容:

    • 指定git仓库:$projectroot = "/home/git/repositories";

    修改apache2配置

    vim /etc/apache2/conf-available/gitweb.conf
    

    内容如下:

    <IfModule mod_alias.c>
      <IfModule mod_mime.c>
        <IfModule mod_cgi.c>
          Define ENABLE_GITWEB
        </IfModule>
        <IfModule mod_cgid.c>
          Define ENABLE_GITWEB
        </IfModule>
      </IfModule>
    </IfModule>
    
    <IfDefine ENABLE_GITWEB>
      Alias /gitweb /usr/share/gitweb
    
      <Directory /usr/share/gitweb>
        Options +FollowSymLinks +ExecCGI
        AddHandler cgi-script .cgi
      </Directory>
    </IfDefine>
    

    使cgi生效

    sudo a2enmod cgi 
    sudo service apache2 restart
    

    测试

    访问gitweb服务器ip对应的地址即可,假设地址是:192.168.1.1/gitweb

    Project Description Owner Last Change
    xx/.git Unnamed repository; edit this file 'description' to name the repository. 5 days ago

    就可看到git的项目信息

    如果说我的文章对你有用,只不过是我站在巨人的肩膀上再继续努力罢了。
    若在页首无特别声明,本篇文章由 Schips 经过整理后发布。
    博客地址:https://www.cnblogs.com/schips/
  • 相关阅读:

    暴力求解/数学问题
    Leetcode207. Course Schedule
    Balanced Team
    由先序和中序求后序
    Median String
    树的同构
    uva 202
    整除光棍
    阅览室
  • 原文地址:https://www.cnblogs.com/schips/p/config_gitweb_serveice_based_on_apache2_on_ubuntu.html
Copyright © 2011-2022 走看看