1

I have gitweb and gitolite installed. I can configure a repo for gitweb access and it appears in the "projects.list" file but the repo is not listed by gitweb in the browser.

I've been searching and searching but can't find what I am missing to make this work.

My gitweb.conf contains

$git_temp = "/tmp";

# The directories where your projects are. Must not end with a slash.
$projectroot = "/srv/git/repositories"; 
$projects_list = "/srv/git/projects.list";

My .gitolite.rc contains

$PROJECTS_LIST = $ENV{HOME} . "/projects.list";

I've checked and the projects.list file goes get updates as per changes to the gitlite config once that is pushed back to the repo. So I think it's just gitweb not seeing the list and acting on it, but I can't figure out know why.

I just get the gitweb page with "404 - No projects found" where the project list should be.

UPDATE:

I found that in my case the problem was caused by incorrect Apache config. I had followed http://git@boron/testing.git. I had the following in my VirtualHost:

# Make sure we can execute gitweb okay
<Directory "/srv/http/gitweb">
        Options ExecCGI
        AllowOverride None
        AddHandler cgi-script .cgi
        DirectoryIndex gitweb.cgi
        Order allow,deny
        Allow from all
</Directory>

This executed gitweb.cgi directly, as the httpd user and without any environment settings. I replaced this block with an explicit call to my suexec wrapper:

# Call GitoWeb cgi via suexec wrapper for relevant URLs
ScriptAliasMatch "^/$" /srv/http/git-suexec/gitweb.cgi.suexec-wrapper

And that fixed my problem.

4

1 に答える 1

0

OPがコメントで言及しているように、Apache構成のVirtulaHostが正しいパラメーター/環境変数を使用してgitweb.cgiを呼び出すことを確認する必要があります。

httpd.confこれがそのサービスの私のものです:
それがどのように回避ScriptAliasMatchし、どのように設定するかに注意してくださいGIT_HTTP_BACKEND

# GitWeb on 8443 # or any port you want
Listen 8443
<VirtualHost hostname>
    ServerName hostname
    ServerAlias short-hostname
    SSLCertificateFile "/path/to/apache/crt"
    SSLCertificateKeyFile "/path/to/apache/key"
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SetEnv GIT_HTTP_BACKEND /path/to/git/libexec/git-core/git-http-backend
    DocumentRoot /path/to/gitweb
    Alias /gitweb /path/to/gitweb
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
      SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /path/to/gitweb>
        SSLOptions +StdEnvVars
        Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
        AllowOverride All
        order allow,deny
        Allow from all

        AuthName "LDAP authentication for GitWeb repositories"
        AuthType Basic
        AuthBasicProvider myldap companyldap
        AuthzLDAPAuthoritative On
        Require valid-user

        AddHandler cgi-script cgi
        DirectoryIndex gitweb.cgi

        RewriteEngine Off
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^[a-zA-Z0-9_\-]+\.git/?(\?.*)?$ /gitweb.cgi%{REQUEST_URI} [L,PT]
    </Directory>
</VirtualHost>

元の答え:

これが私のものgitweb.conf.plです:

my $gl_home = $ENV{HOME} = "@H@";

# the following variables are needed by gitolite; please edit before using

# this should normally not be anything else
$ENV{GL_RC} = "$gl_home/.gitolite.rc";
# this can have different values depending on how you installed.

# if you used RPM/DEB or "root" methods it **might** be this:
$ENV{GL_BINDIR} = "/usr/local/bin";
# if you used the "non-root" method it **might** be this:
$ENV{GL_BINDIR} = "$gl_home/gitolite/bin";
# If in doubt take a look at ~/.ssh/authorized_keys; at least one of the lines
# might contain something like:
#       command="/home/git/.gitolite/src/gl-auth-command
# and you should use whatever directory the gl-auth-command is in (in this
# example /home/git/.gitolite.src)

# finally the user name
$ENV{GL_USER} = $cgi->remote_user || "gitweb";

# now get gitolite stuff in...
unshift @INC, $ENV{GL_BINDIR};
require gitolite_rc;    gitolite_rc -> import;
require gitolite;       gitolite    -> import;

# set project root etc. absolute paths
$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$gl_home/$REPO_BASE" );
$projects_list = $projectroot = $ENV{GL_REPO_BASE_ABS};

$export_auth_hook = sub {
    my $repo = shift;
    # gitweb passes us the full repo path; so we strip the beginning
    # and the end, to get the repo name as it is specified in gitolite conf
    return unless $repo =~ s/^\Q$projectroot\E\/?(.+)\.git$/$1/;

    # check for (at least) "R" permission
    my ($perm, $creator) = &repo_rights($repo);
    return ($perm =~ /R/);
};

@H@ を、、、、ファイルがあるパスに置き換えます.gitolite.gitolitercrepositoriesproject.list

定義方法に注意してください$ENV{GL_BINDIR}: 2 番目の定義についてはコメントしませんでした。私の場合は非ルート インストールを行ったため、次のようになります。

$ENV{GL_BINDIR} = "$gl_home/gitolite/bin";

があることを確認してくださいgitweb_config.perl

our $home_link_str = "ITSVC projects";
our $site_name = "ITSVC Gitweb";

use lib (".");
require "gitweb.conf.pl";

それが、ギトライトと呼ばれるgitwebエクストラとの間のリンクを作成するものです。gitweb.conf.pl

于 2012-03-20T08:00:09.987 に答える