Date: Mon, 29 Mar 2021 22:18:35 +0200 From: Michael Gmelin <freebsd@grem.de> To: "Hartmann, O." <ohartmann@walstatt.org> Cc: FreeBSD Ports <freebsd-ports@freebsd.org> Subject: Re: devel/git: Git via Apache 2.4 HTTPS - info/refs not valid: could not determine hash algorithm Message-ID: <20210329221835.752fa286@bsd64.grem.de> In-Reply-To: <20210329202624.6b4d809c@hermann.fritz.box> References: <20210328130819.01a1d7e6@hermann.fritz.box> <20210329114228.69fae81b@bsd64.grem.de> <20210329202624.6b4d809c@hermann.fritz.box>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 29 Mar 2021 20:26:24 +0200 "Hartmann, O." <ohartmann@walstatt.org> wrote: > On Mon, 29 Mar 2021 11:42:28 +0200 > Michael Gmelin <freebsd@grem.de> wrote: > > > On Sun, 28 Mar 2021 13:08:19 +0200 > > "Hartmann, O." <ohartmann@walstatt.org> wrote: > > > > > What am I missing here? > > > > > > > The man page of git-http-backend has an apache2 example[0]. > > Also, the top answer to this stackoverflow question might give you a > > hint: https://stackoverflow.coo-set-up-git-over-http > > > > Best, > > Michael > > > > [0]https://www.freebsd.org/cgi/man.cgi?query=git-http-backend&apropos=0&sektion=0&manpath=FreeBSD+12.2-RELEASE+and+Ports&arch=default&format=html > > > > > > Hello Michael, > > thanks for responding. > The first tip I came across was the Stackoverflow HowTo - whatever I > did and do, it doesn't work. I also tried the several variants shown > in [0], starting with the simplest towards more complex ones. > > Following strictly the reference at > > https://stackoverflow.com/questions/26734933/how-to-set-up-git-over-http > > with minor local adaptions (for FreeBSD and the Git base folder), > even with anonymous access allowed the failure is the same as with > some Basic authentication via LDAP. > > As decribed in my initial email: first access with a "git push -u > origin master" is logged by Apache with 401, requesting credentials. > If provided, the line (httpd-access.log): > > xx.xx.xx.xx - USERNAME [29/Mar/2021:17:44:55 +0000] "GET \ > /git/test.git/info/refs?service=git-upload-pack HTTP/1.1" 200 1689032 > "-" "git/2.31.0" \ 323 1691601 > > status code 200 indicates OK - so authetication is all right and I > should proceed, but I get on the client > > fatal: https://[url]/git/test.git/info/refs not valid: could not > determine hash algorithm; is this a git repository? > > On both sides, I had disabled sslVerify (due to self signed cert > issue with git, another pitfall) and according to stackoverflow > howto, hooks are also prepared and the root folder and its subsequent > folders /pool/gitbase (PROJECT_ROOT) is owned by www:www and has ACL > 0775 set. > > And this is why it gets desperate to me ... I played a bit with this - turns out that the key is to make sure that the cgi module is loaded (e.g., mod_cgi). This is the simple basic setup I tested (using bash): pkg install apache24 git service apache24 enable cat >/usr/local/etc/apache24/Includes/git.conf<<"EOF" LoadModule cgi_module libexec/apache24/mod_cgi.so LoadModule rewrite_module libexec/apache24/mod_rewrite.so ServerName 127.0.0.1 SetEnv GIT_PROJECT_ROOT /usr/local/www/git/ SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/local/libexec/git-core/git-http-backend/ RewriteCond %{QUERY_STRING} service=git-receive-pack [OR] RewriteCond %{REQUEST_URI} /git-receive-pack$ RewriteRule ^/git/ - [E=AUTHREQUIRED:yes] <LocationMatch "^/git/"> Order Deny,Allow Deny from env=AUTHREQUIRED AuthType Basic AuthName "Git Access" Require group committers Satisfy Any </LocationMatch> EOF mkdir -p /usr/local/www/git/test.git git init --bare /usr/local/www/git/test.git service apache24 start git clone http://localhost/git/test Cheers, Michael > > Kind regards, > > O. Hartmann -- Michael Gmelin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210329221835.752fa286>