
Estoy intentando configurar gitolite para que funcione en nginx con gitweb. Y a pesar de que gitweb funciona perfectamente y reconoce todas las funciones de control de acceso proporcionadas por gitolite, parece que no puedo acceder a los repositorios a través de http. Por ejemplo, cuando intento recuperar un repositorio, obtengo:
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
Mi configuración actual de nginx se ve así:
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;
}
}
Gitolite se instala en /srv/git y todos los repositorios (junto con los archivos de configuración de gitolite, etc.) se almacenan en /srv/http (ejecutando gitolite bajo el usuario http). Sospecho que es un problema de mala configuración. ¿Qué debo hacer para que sea posible operar git a través de http con mi configuración actual? Yo uso Arch, por cierto
Respuesta1
Pues la solución estaba a sólo 1 paso de distancia.GITOLITE_HTTP_HOME
El parámetro solo necesita apuntar a/srv/http;
en lugar de/srv/git;.
Y eso es. Tanto gitweb como git funcionan perfectamente y respetan los permisos establecidos en gitolite.conf.