2

这是你经常发现的话题。但是,自 2 天以来,我尝试了所有方法,但我的想法已经不多了。希望有人可以在这里帮助我。

一般来说,我做了以下事情:

  • apt-get 安装 gitolite gitweb
  • 将 repos 添加到 gitolite.conf(见下文)
  • 将用户 www-data 添加到 gitolite 组
  • 手动创建projects.list(见下文)
  • 设置符号链接 /var/www/gitweb -> /usr/share/gitweb
  • 设置 gitweb vhost(见下文)

当我现在浏览到http://git.example.org时,我看到 gitweb 带有消息“404 - 未找到项目”。日志文件中没有错误消息。

1)Gitolite目录:

drwxr-xr-x  5 gitolite gitolite 4096 Mai  6 20:03 .
drwxr-xr-x 43 root     root     4096 Mai  6 18:12 ..
drwxr-x---  8 gitolite gitolite 4096 Mai  6 18:12 .gitolite
-rw-r-xr--  1 gitolite gitolite 4217 Mai  6 19:43 .gitolite.rc.new
-rwxr-xr-x  1 gitolite gitolite   25 Mai  6 19:59 projects.list
drwxr-xr-x  6 gitolite gitolite 4096 Mai  6 18:14 repositories
drwxr-x---  2 gitolite gitolite 4096 Mai  6 18:14 .ssh

2) gitolite.conf

repo    gitolite-admin
        RW+ = admin

repo    repo1
        RW+ = admin
        R   = @all

repo    repo2
        RW+ = admin
        R   = @all

3) .gitolite.rc.new(为什么在这里附加 .new?使用 apt-get install gitolite 安装 gitolite)

# ------------------------------------------------------------------------------
# DO NOT TOUCH THIS SECTION!
# ------------------------------------------------------------------------------

$GL_ADMINDIR=$ENV{HOME} . "/.gitolite";
$GL_CONF="$GL_ADMINDIR/conf/gitolite.conf";
$GL_KEYDIR="$GL_ADMINDIR/keydir";
$GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm";

# DO NOT CHANGE THE NEXT FOUR LINES UNLESS YOU REALLY KNOW WHAT YOU'RE DOING.
# These variables are set automatically by the install method you choose.
#            (PACKAGE MAINTAINERS: PLEASE READ doc/packaging.mkd)
$GL_PACKAGE_CONF = "/usr/share/gitolite/conf";
$GL_PACKAGE_HOOKS = "/usr/share/gitolite/hooks";

# ------------------------------------------------------------------------------
# most often used/changed variables
# ------------------------------------------------------------------------------
$GL_WILDREPOS = 0;
$PROJECTS_LIST = $ENV{HOME} . "/projects.list";
# $WEB_INTERFACE = "gitweb";
# $GITWEB_URI_ESCAPE = 0;
$REPO_UMASK = 0022;

4) /var/lib/gitolite/projects.list

repo1.git
repo2.git

5) /var/lib/gitolite/repositories

drwxr-xr-x 7 gitolite gitolite 4096 Mai  6 18:14 repo1.git
drwxr-xr-x 7 gitolite gitolite 4096 Mai  6 18:14 repo1.git

6) gitweb 虚拟主机:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName git.example.org

    SetEnv GITWEB_CONFIG   /etc/gitweb.conf
    SetEnv GIT_PROJECT_ROOT /var/lib/gitolite/repositories

    DocumentRoot /var/www/gitweb

    <Directory /var/www/gitweb>
      Options FollowSymLinks ExecCGI
      AllowOverride All
      order allow,deny
      Allow from all
      AddHandler cgi-script .cgi

      DirectoryIndex index.cgi

      # Pretty gitweb URLs
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^.* /index.cgi/$0 [L,PT]
    </Directory>

    # Enable git clone over HTTP
    ScriptAliasMatch \
    "(?x)^/(.*/(HEAD | \
        info/refs | \
        objects/(info/[^/]+ | \
        [0-9a-f]{2}/[0-9a-f]{38} | \
        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
        git-(upload|receive)-pack))$" \
        /usr/lib/git-core/git-http-backend/$1

    ErrorLog /var/log/apache2/git-error.log
    CustomLog /var/log/apache2/git-access.log combined
</VirtualHost>

7) /etc/gitweb.conf

# path to git projects (<project>.git)
$projectroot = "/var/lib/gitolite/repositories";

@git_base_url_list = ("git://git.example.org", "http://git.example.org");

$site_name = "git.example.com";

# require export flag
$export_ok = "git-daemon-export-ok";
$strict_export = 1;

# directory to use for temp files
$git_temp = "/tmp";

# target of the home link on top of all pages
#$home_link = $my_uri || "/";

# html text to include at home page
#$home_text = "indextext.html";

# file with project list; by default, simply scan the projectroot dir.
$projects_list = "/var/lib/gitolite/projects.list";

# stylesheet to use
#@stylesheets = ("static/gitweb.css");

# javascript code for gitweb
#$javascript = "static/gitweb.js";

# logo to use
#$logo = "static/git-logo.png";

# the 'favicon'
#$favicon = "static/git-favicon.png";

# git-diff-tree(1) options to use for generated patches
#@diff_opts = ("-M");
@diff_opts = ();

非常感谢你!

4

2 回答 2

0

只是为了完整起见-我在 2013 年 5 月 6 日的回答:-)

这一切都是为了gitolite v2

我终于让它工作了:首先将“gitweb daemon”添加到 gitolite.conf 中的所有 R,然后将“SetEnv GIT_HTTP_BACKEND /usr/lib/git-core/git-http-backend”添加到 vhost 文件。不知道这两个更改是否都是必要的。

于 2015-03-12T09:42:32.640 回答
0

就我而言,这只是/home/gitolite/repositories/目录权限的问题。

或者它可能是 umask 设置的问题 - 根据DOC默认 umask 是0700,对于 cgit / gitweb 作品0027

于 2015-08-31T15:10:14.737 回答