2012-08-20 2 views
1

우분투 12.04 서버에 git + gitolite + git-daemon + gitweb 설정을 설치했습니다. 문제는 내가 항상 404 - 프로젝트가 없습니다. git이라는 사용자를 추가하고 gitolite를 구성했습니다. git-web을 설치 한 후 gitolite에 사용자 www-data를 추가하고 project.list의 chmod를 g + r로 설정하고 repositories 디렉토리를 g + rx로 설정합니다. gitweb 404 - 프로젝트가 없습니다.

[email protected]~$ ls -al 
total 44 
drwxr-xr-x 6 git git 4096 Aug 20 16:47 . 
drwxr-xr-x 18 root root 4096 Aug 13 19:44 .. 
-rw------- 1 git git 1348 Aug 20 16:48 .bash_history 
drwx------ 2 git git 4096 Aug 19 16:38 .cache 
drwx------ 8 git git 4096 Aug 19 16:30 .gitolite 
-rw-r--r-- 1 git git 4217 Aug 20 16:03 .gitolite.rc 
-rw-r----- 1 git git  0 Aug 20 16:05 projects.list 
drwxr-x--- 5 git git 4096 Aug 19 16:49 repositories 
drwx------ 2 git git 4096 Aug 20 16:05 .ssh 
-rw------- 1 git git 887 Aug 20 16:03 .viminfo 

지금 내 /etc/gitweb.conf의 0077

다음은 $ projectroot을 변경

# configuration variables for gitolite 

# PLEASE READ THE DOCUMENTATION BEFORE EDITING OR ASKING QUESTIONS 
# (http://github.com/sitaramc/gitolite/blob/pu/doc/gitolite.rc.mkd) 
# (or http://sitaramc.github.com/gitolite/doc/gitolite.rc.html) 

# this file is in perl syntax. However, you do NOT need to know perl to edit 
# it; it should be fairly self-explanatory and easy to maintain 

# ------------------------------------------------------------------------------ 
# 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 = 0027; 

# ------------------------------------------------------------------------------ 
# variables with an efficiency/performance impact 
# ------------------------------------------------------------------------------ 
$GL_BIG_CONFIG = 0; 
$GL_NO_DAEMON_NO_GITWEB = 0; 
# $GL_NICE_VALUE = 0; 
# $BIG_INFO_CAP = 20; 

# ------------------------------------------------------------------------------ 
# VARIABLES WITH A SECURITY IMPACT. READ DOCS BEFORE CHANGING THESE! 
# http://github.com/sitaramc/gitolite/blob/pu/doc/gitolite.rc.mkd#_variables_with_a_security_impact 
# (or http://sitaramc.github.com/gitolite/doc/gitolite.rc.html#_variables_with_a_security_impact) 
# ------------------------------------------------------------------------------ 
# $GL_ALL_READ_ALL = 0; 
$GIT_PATH=""; 
$GL_GITCONFIG_KEYS = ""; 
$GL_NO_CREATE_REPOS = 0; 
$GL_NO_SETUP_AUTHKEYS = 0; 
# $GL_WILDREPOS_DEFPERMS = 'R @all'; 
$HTPASSWD_FILE = ""; 
$RSYNC_BASE = ""; 
$SVNSERVE = ""; 

# $UPDATE_CHAINS_TO = "hooks/update.secondary"; 
# $ADMIN_POST_UPDATE_CHAINS_TO = "hooks/post-update.secondary"; 
# $GL_ADC_PATH = ""; 
# $GL_GET_MEMBERSHIPS_PGM = "/usr/local/bin/expand-ldap-user-to-groups" 
# $GL_HTTP_ANON_USER = "mob"; 
# $GL_REF_OR_FILENAME_PATT=qr(^[0-9a-zA-Z][0-9a-zA-Z._\@/+ :,-]*$); 

# ------------------------------------------------------------------------------ 
# less used/changed variables 
# ------------------------------------------------------------------------------ 
# $GL_ALL_INCLUDES_SPECIAL = 0; 
# $GL_SLAVE_MODE = 0; 
# $ENV{GL_SLAVES} = '[email protected] [email protected]'; 
# PLEASE USE SINGLE QUOTES ABOVE, NOT DOUBLE QUOTES 
$GL_WILDREPOS_PERM_CATS = "READERS WRITERS"; 
# $GL_SITE_INFO = "XYZ.COM DEVELOPERS: PLEASE SEE http://xyz.com/gitolite/help first"; 
# $GL_HOSTNAME = "frodo";  # read doc/mirroring.mkd COMPLETELY before setting this 

# ------------------------------------------------------------------------------ 
# rarely changed variables 
# ------------------------------------------------------------------------------ 
$GL_LOGT="$GL_ADMINDIR/logs/gitolite-%y-%m.log"; 
# $GL_PERFLOGT="$GL_ADMINDIR/logs/perf-gitolite-%y-%m.log"; 

# ------------------------------------------------------------------------------ 
# variables that should NOT be changed after the install step completes 
# ------------------------------------------------------------------------------ 
$REPO_BASE="repositories"; 

# ------------------------------------------------------------------------------ 
# DO NOT TOUCH ANY THING AFTER THIS LINE 
# ------------------------------------------------------------------------------ 

# ------------------------------------------------------------------------------ 
# per perl rules, this should be the last line in such a file: 
1; 

# Local variables: 
# mode: perl 
# End: 
# vim: set syn=perl: 
여기 내 .gitolite.rc 및 내 .gitolite.rc에 $ projects_list을 $ REPO_UMASK 변경 몇 가지 구성을 추가했습니다. 여기 내 gitweb.conf는
# path to git projects (<project>.git) 
$projectroot = "/home/git/repositories"; 

# 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 = "/home/git/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 =(); 


# Enable PATH_INFO so the server can produce URLs of the 
# form: http://git.cdwilson.us/project.git/xxx/xxx 
# This allows for pretty URLs *within* the Git repository, where 
# my Apache rewrite rules are not active. 
$feature{'pathinfo'}{'default'} = [1]; 

$projects_list_description_width = 100; 

# Enable blame, pickaxe search, snapshop, search, and grep 
# support, but still allow individual projects to turn them off. 
# These are features that users can use to interact with your Git trees. They 
# consume some CPU whenever a user uses them, so you can turn them off if you 
# need to. Note that the 'override' option means that you can override the 
# setting on a per-repository basis. 
$feature{'blame'}{'default'} = [1]; 
$feature{'blame'}{'override'} = 1; 

$feature{'pickaxe'}{'default'} = [1]; 
$feature{'pickaxe'}{'override'} = 1; 

$feature{'snapshot'}{'default'} = [1]; 
$feature{'snapshot'}{'override'} = 1; 

$feature{'search'}{'default'} = [1]; 

$feature{'grep'}{'default'} = [1]; 
$feature{'grep'}{'override'} = 1; 

$feature{'show-sizes'}{'default'} = [1]; 
$feature{'show-sizes'}{'override'} = 1; 

$feature{'avatar'}{'default'} = ['gravatar']; 
$feature{'avatar'}{'override'} = 1; 

$feature{'highlight'}{'default'} = [1]; 
$feature{'highlight'}{'override'} = 1; 

마지막으로 내 아파치

<VirtualHost 88.198.64.228:80> 
     ServerName git.aranox.de 
     ServerAlias www.git.aranox.de 
     DocumentRoot /usr/share/gitweb 
     ErrorLog /var/log/vhosts/git.aranox.de_error_log 
     CustomLog /var/log/vhosts/git.aranox.de_access_log combined 
     <Directory /usr/share/gitweb> 
       Options +Indexes +ExecCGI +FollowSymLinks 
       AllowOverride All 
       Order allow,deny 
       Allow from all 
       AddHandler cgi-script .cgi 
       DirectoryIndex gitweb.cgi 
       RewriteEngine On 
       RewriteCond %{REQUEST_FILENAME} !-f 
       RewriteCond %{REQUEST_FILENAME} !-d 
       RewriteRule ^.* /index.cgi/$0 [L,PT] 
     </Directory> 
</VirtualHost> 

내가 아파치를 다시 시작하고 잘 보이는,하지만 여전히 오류가 "어떤 프로젝트를 찾을 수 없습니다"하기에 새로운 가상 호스트 항목을 만들었습니다. 나는 구글과 stackoverflow에서 검색을 사용했지만 여전히 해결책을 찾지 못했습니다. 항상 권한이 잘못되었다는 것을 알았지 만 그럴 수도 있습니다.

모든 솔루션에 감사드립니다. OP Zack

답변

1

gitolite 구문 분석하는 프로젝트 목록을 알기 위해 (또한 gitweb에서 사용)을 project.list 파일을 사용합니다, 언급하고있다.

projects.list이 비어 있습니다. 왜 그런지 모르겠어.
리포지토리를 수동으로 추가했습니다.

이 질문은 "Gitweb document root with gitolite"과 비슷하지만 project.list을 추가하는 것으로 충분합니다.


원래 답 : 여기에

아무것도 직접 gitolite 호출하고 gitolite.rc 파일은 G2 (gitolite의 V2) 파일이 아닌 g3 one입니다.

그래서 먼저 최신 gitolite V3을 설치하십시오 (이 installation script for instance 참조).

둘째, 자식 - 데몬이 설치 필요하지 않습니다 다음 gitweb.cgi 스크립트를 호출에만 아파치 서버 : this httpd.conf config file을 참조 아래 추출 :

# GitWeb on @[email protected] 
Listen @[email protected] 
<VirtualHost @[email protected]:@[email protected]> 
ServerName @[email protected] 
ServerAlias @[email protected] 
SetEnv GIT_HTTP_BACKEND "@[email protected]/usr/local/apps/git/libexec/git-core/git-http-backend" 
DocumentRoot @[email protected]/gitweb 
Alias /git @[email protected]/gitweb 

<Directory @[email protected]/gitweb> 
    AddHandler cgi-script cgi 
    DirectoryIndex gitweb.cgi 

gitweb와 gitolite 사이의 링크를 통해 만들어 gitweb 훅 (gitweb hook) : gitweb이 다른 웹 페이지 파일을 따라 (예 : this one)의 존재를 감지하면이를 호출합니다. 나는 차례대로 export_auth_hook이라는 함수를 가진 gitweb.conf.pl file을 호출하게한다. 이것은 gitweb에 의해 호출되는 훅 (존재한다면 다시)이다.

$export_auth_hook = sub { 
    my $repo = shift; 
    my $user = $ENV{GL_USER}; 
    # 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 $ret = &access($repo, $user, 'R', 'any'); 
    my $res = $ret !~ /DENIED/; 
    return ($ret !~ /DENIED/); 
}; 

그리고 그것은 : gitweb가 gitolite 설정에 따라 액세스 권한이있는 프로젝트를 표시하기에 충분합니다.
그러나 이것은 "Missing repos in gitweb"에서 설명한 것처럼 git repo를 복제/푸시하거나 당기는 방법이 아닙니다.

+0

git-lite를 apt를 사용하여 설치 했으므로 최신 버전을 구할 수 있습니까? 어디에 gitweb.conf.pl 파일을 만드시겠습니까? 나는 왜 이것을 할 필요가 있는지 이해하지 못했고, /etc/gitweb.conf에 내 저장소와 내 projects_list 경로를 설정하여 아파치에 대한 폴더와 파일에 대한 액세스 권한을 부여했습니다. 내 리포지토리 이름을 반환하는 데 필요한 스크립트가 있는지 확인하십시오. wtf – Zack

+0

다른 방법이있을 수 있습니다 (http://stackoverflow.com/a/10810347/6309). 그러나 나는 기존의'gitweb.conf' 파일에'gitweb.conf.pl' 권한을 추가하는 것을 선호합니다. 'gitolite.conf' 파일에보고 싶은 저장소를 선언하십시오 : http://sitaramc.github.com/gitolite/external.html – VonC

+0

고마워요.하지만, 도스는 작동하지 않습니다/도와주세요. – Zack

관련 문제