Debian + Gitolite + Gitweb = 404 - 未找到任何项目

时间:2013-05-06 18:35:15

标签: debian gitolite gitweb

这是您经常找到的主题。但是,我从2天开始尝试了一切,但我的想法已经不多了。希望有人可以帮助我。

总的来说,我做了以下事情:

  • apt-get install gitolite gitweb
  • 将回购添加到gitolite.conf(见下文)
  • 将用户www-data添加到组gitolite
  • 手动创建projects.list(见下文)
  • set symlink / var / www / gitweb - >的/ usr /共享/叫做gitweb
  • 设置gitweb vhost(见下文)

当我现在浏览http://git.example.org时,我看到gitweb的消息“404 - No projects found”。日志文件中没有错误消息。

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 (为什么在这里。附加?安装了gitolite与apt-get install 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 vhost:

<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 = ();

非常感谢!

2 个答案:

答案 0 :(得分:0)

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

gitolite v2

  

我终于完成了工作:首先添加&#34; gitweb守护进程&#34;在gitolite.conf中的所有R和第二个添加&#34; SetEnv GIT_HTTP_BACKEND / usr / lib / git-core / git-http-backend&#34;到vhost文件。不知道两种变化是否都是必要的。

答案 1 :(得分:0)

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

或者umask设置可能有问题 - 根据DOC默认umask是0700,因为cgit / gitweb有效0027