Gitolite和Gitweb:无法找到Gitolite / Easy.pm

时间:2018-02-07 15:34:10

标签: git perl gitolite gitweb

我在CentOS上运行Git和Gitolite。

这两个正在运行(SSH访问),我试图安装GitWeb并将其连接到GitoLite。我按照GitoLite tutorial-page上的说明进行操作。

GitoLite安装在/home/git,GitWeb安装在/var/www/git

apache用户是Git组的组成员,SELinux被禁用。

当我访问GitWeb时,它给了我一个错误:

  

无法在@INC中找到Gitolite / Easy.pm(@INC包含:   / home / git / bin / lib / usr / local / lib64 / perl5 / usr / local / share / perl5   / usr / lib64 / perl5 / vendor_perl / usr / share / perl5 / vendor_perl   / usr / lib64 / perl5 / usr / share / perl5。)在/etc/gitweb.conf第10行。   BEGIN失败 - 编译在/etc/gitweb.conf第10行中止。

我在/home/git/bin/lib/Gitolite/Easy.pm寻找模块,它存在于那里。所以这条道路似乎是正确的。

/etc/gitweb.conf

BEGIN {
    $ENV{HOME} = "/home/git";   # or whatever is the hosting user's $HOME
    $ENV{GL_BINDIR} = "/home/git/bin";
    $ENV{GL_LIBDIR} = "/home/git/bin/lib";
}

# Pull in gitolite's perl API module.  Among other things, this also sets the
# GL_REPO_BASE environment variable.
use lib $ENV{GL_LIBDIR};
use Gitolite::Easy;

# Set projectroot for gitweb.  If you already set it earlier in gitweb.conf
# you don't need this but please make sure the path you used is the same as
# the value of GL_REPO_BASE in the 'gitolite query-rc -a' output above.
$projectroot = $ENV{GL_REPO_BASE};

# Now get the user name.  Unauthenticated clients will be deemed to be the
# 'gitweb' user so make sure gitolite's conf file does not allow that user to
# see anything sensitive.
$ENV{GL_USER} = $cgi->remote_user || "gitweb";

$export_auth_hook = sub {
    my $repo = shift;
    # gitweb passes us the full repo path; we need to 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/;

    # call Easy.pm's 'can_read' function
    return can_read($repo);
};

/etc/httpd/httpd.conf

Alias /gitweb "/var/www/git"
<Directory /var/www/git>
    DirectoryIndex gitweb.cgi
    Options ExecCGI
    Require all granted
    <Files gitweb.cgi>
    SetHandler cgi-script
    </Files>
    SetEnv  GITWEB_CONFIG  /etc/gitweb.conf
</Directory>

0 个答案:

没有答案