首页 > 服务器 > Ubuntu1604创建gitweb服务器

作者:ghostry 发布时间:2018-01-28 浏览: 2688

转载注明出处: https://blog.1ge.fun/server/838.html

gitweb网上教程也不少。不过相当麻烦,
事实上,Ubuntu16.04上面非常简单的就可以创建

只需要

sudo apt install gitweb libcgi-pm-perl
a2enmod cgi
server apache2 restart

就可以了。其中libcgi-pm-perl是通过错误信息找到的缺少依赖。见这里

http://Ubuntu的ip/gitweb/

就能看到页面。
默认的仓库目录在

/var/lib/git

在此目录下初始化仓库即可。

root@userver:/var/lib/git# git init --bare one.git
初始化空的 Git 仓库于 /var/lib/git/one.git/

或者从别的地方镜像仓库过来。

git clone --mirror https://github.com/[username]/[repo].git

如果不是有定制需要,根本不需要修改配置文件。网上教程又是写配置,又是建用户的。
如果有定制需求,继续。

cat /etc/gitweb.conf 
# path to git projects (<project>.git)
$projectroot = "/var/lib/git";

这个文件写着主目录地址,可以改。

cat /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>

这个文件是Apache的配置文件。可以写conf,也可以改成site。

标签: ubuntu git

上一篇: openwrt挂摄像头
下一篇: ubuntu1604下lxd使用。

添加新评论 »

*
*

欢迎评论!歡迎評論!Comments welcome!komentoj bonvenaj!댓글 오신 것을 환영합니다!
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: :cold: :cryy: :cute: :shy: :sleep: :struggle: :tea: :yahou: