13

我正在尝试让 gitweb 与 gitolite 一起工作......但到目前为止没有成功。
我正在使用 RedHat Linux 机器。一个名为git存在的用户。

gitolite 安装在:/home/git
存储库位置:/home/git/repositories

请注意,gitweb 在普通的 git 上运行良好。现在我正试图让它与 gitolite 一起工作。

这是我的文件的样子:

  • /etc/gitweb.conf

    $projectroot = "/home/git/repositories";
    @git_base_url_list = qw(ssh://[MyHostName]/home/git/projects.list);
    $projects_list = "/home/git/projects.list"
    
  • /home/git/projects.list

    myrepo1.git
    myrepo2.git 
    
  • /home/git/.gitolite.rc

    $PROJECTS_LIST = $ENV{HOME} . "/projects.list";
    $GL_GITCONFIG_KEYS = "gitweb.url receive.denyNonFastforwards receive.denyDeletes";
    

我错过了什么配置?我没有对 Apache 进行任何更改。

Web URL:http://MyHostName/git
这给出了一个 404 错误,说 - No repositories found

4

3 回答 3

13

我最近设置了 gitolite 和 gitweb,发现只/etc/gitweb.conf需要很少的配置。你所拥有的对我来说是正确的。什么是权限/home/git/repositories?您可能会发现它们过于严格。试试这个:

$ chmod -R 775 /home/git/repositories

这就是为我解决问题的原因(尽管我想有一种更安全的方法来设置权限)。如果可行,我建议您只考虑为 Apache(或正在执行的任何用户帐户 gitweb)提供对存储库目录的更细粒度的权限。

我的也有这个.gitolite.rc

GIT_CONFIG_KEYS => 'gitweb\.(owner|description|category)',

以便以下工作<gitolite-admin>/conf/gitolite.conf

config gitweb.owner         =   owner name
config gitweb.description   =   some description
config gitweb.category      =   some category
于 2012-05-30T05:16:35.487 回答
0

您需要contrib/gitweb.conf. 换句话说,你需要从你的perl 文件中调用一个 Gitolite 函数,否则 GitWeb-Gitolite 的集成将永远无法工作。/etc/gitweb_config.perl
gitweb.conf

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

(这repo_rights是来自gitolite.pm的方法)

检查“帮助 gitweb ”部分。

您需要在末尾添加的最后几行gitweb_config.perl是:

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

这样,您将避免任何“ 500 - Internal Server Error syntax error at /etc/gitweb.conf”错误消息。

如果您没有gitweb_config.perl在其中声明的gitweb.conf.pl,而是直接“ gitweb.conf.pl”,则添加“ use lib (".");”作为该文件的第一行。

于 2011-08-27T18:54:35.803 回答
0

1/ 安装gitolite并设置它。然后确保/home/git/.gitolite.rc包含如下所示的未注释部分就足够了:

%RC = (
    ...
    UMASK                           =>  0027,
    ...
    ENABLE => [
        ...
        'gitweb',
        ...
     ]
);

2/ 正确设置$projectroot$projects_list指令/etc/gitweb.conf(以匹配projects.list文件和repositories目录的位置)。喜欢:

$projectroot = "/home/git/repositories";
...
$projects_list = "/home/git/projects.list";

3/ 确保网络服务器用户也可以读取当前的存储库文件。这些示例来自基于 debian 的系统,因此 YMMV:

sudo adduser www-data git                   # append `www-data` user to a `git` group
sudo chmod g+r /home/git/projects.list      # make sure group members can read the `project.list`
sudo chmod -R g+rx /home/git/repositories   # recursively set less restrictive access mode for group members
sudo /etc/init.d/apache2 restart            # restart web server to apply these changes

4 / 最后在客户端计算机上的存储库文件中为gitweb用户配置访问权限,并通过提交和推送它们(标准方式)来应用它们。我们希望通过它查看和管理的存储库必须具有如下访问设置:/conf/gitolite.confgitolite-admingitweb

repo testing                                                                    
    RW+     = @all                                                              
    R       = gitweb  # add this line to make the repo browsable using `gitweb`

注意:...唯一的建议是文件中还有其他配置指令。不要把它们放在那里!

无需其他更改即可使存储库gitlab可视化gitolite

(至少)适用于gitolite3.6.6 和gitweb2.1.4

于 2017-12-19T12:23:02.780 回答