我正在尝试将 gitolite 配置为使用 gitweb 在 nginx 上工作。尽管 gitweb 可以完美地工作并识别 gitolite 提供的所有访问控制功能,但我似乎无法通过 http 访问存储库本身。例如,当我尝试获取 repo 时,我得到:
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?我使用 Arch,顺便说一句