
Estou tentando configurar o gitolite para funcionar no nginx com gitweb. E apesar do gitweb funcionar perfeitamente e reconhecer todas as funcionalidades de controle de acesso fornecidas pelo gitolite, não consigo acessar os repositórios por http. Por exemplo, quando tento buscar um repositório, recebo:
user@hostname:$ git fetch origin master Username for 'http://git.<hostname>': <Username> Password for 'http://<Username>@git.<hostname>': remote: An error occurred while reading CGI reply (no response received) fatal: unable to access 'http://git.<hostname>/git/<reponame>.git/': The requested URL returned error: 502
Minha configuração atual do nginx é assim:
server {
listen 127.0.0.1:80;
server_name git.<hostname>;
root /usr/share/gitweb;
# Basic Authentication
auth_basic "Private Git Server";
auth_basic_user_file /srv/etc/.htpasswd;
location ~ /git(/.*) {
root /srv/git/;
client_max_body_size 0;
# fcgiwrap is set up to listen on this host:port
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /srv/git/gitolite-source/src/gitolite-shell;
# export all repositories under GIT_PROJECT_ROOT
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /srv/http/repositories;
fastcgi_param GITOLITE_HTTP_HOME /srv/git;
fastcgi_param PATH_INFO $1;
fastcgi_pass unix:/var/run/fcgiwrap.sock;
}
try_files $uri @gitweb;
location @gitweb {
fastcgi_pass unix:/var/run/fcgiwrap.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi;
fastcgi_param PATH_INFO $uri;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param GITWEB_CONFIG /srv/git/gitweb/gitweb.conf;
include fastcgi_params;
}
}
O Gitolite é instalado em /srv/git e todos os repositórios (junto com os arquivos de configuração do gitolite e etc) são armazenados em /srv/http (executando o gitolite sob o usuário http). Suspeito que seja um problema de configuração incorreta. O que preciso fazer para possibilitar a operação do git sobre http com minha configuração atual? Eu uso Arch, aliás
Responder1
Bem, a solução estava a apenas 1 passo de distância.GITOLITE_HTTP_HOME
parâmetro só precisa apontar para/srv/http;
em vez de/srv/git;.
E é isso. Tanto o gitweb quanto o git funcionam perfeitamente e respeitam as permissões definidas em gitolite.conf.