
gitweb을 사용하여 nginx에서 작동하도록 gitolite를 구성하려고 합니다. 그리고 gitweb이 완벽하게 작동하고 gitolite가 제공하는 모든 액세스 제어 기능을 인식함에도 불구하고 http를 통해 저장소 자체에 액세스할 수 없는 것 같습니다. 예를 들어 저장소를 가져오려고 하면 다음과 같은 결과가 나타납니다.
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
내 현재 nginx 구성은 다음과 같습니다.
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는 /srv/git에 설치되며 모든 저장소(gitolite 구성 파일 등과 함께)는 /srv/http(http 사용자로 gitolite 실행)에 저장됩니다. 나는 그것이 잘못된 구성 문제라고 생각합니다. 현재 설정으로 http를 통해 git을 작동할 수 있게 하려면 어떻게 해야 합니까? 나는 아치를 사용합니다.
답변1
글쎄요, 해결책은 단 한 단계 떨어져 있었습니다.GITOLITE_HTTP_HOME
매개변수는 다음을 가리켜야 합니다./srv/http;
대신에/srv/git;.
그리고 그게 다야. gitweb과 git 모두 완벽하게 작동하며 gitolite.conf에 설정된 권한을 존중합니다.