嘗試透過 http 克隆/取得任何儲存庫時出現 Gitolite 502

嘗試透過 http 克隆/取得任何儲存庫時出現 Gitolite 502

我正在嘗試配置 gitolite 以使用 gitweb 在 nginx 上工作。儘管 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?我使用 Arch,順便說一句

答案1

好吧,距離解決方案只有 1 步之遙。GITOLITE_HTTP_HOME參數只需要指向/srv/http;代替/srv/git;.就是這樣。 gitweb 和 git 都可以完美運作並尊重 gitolite.conf 中設定的權限。

相關內容