My goal is to get anonymous read access (git clone / git pull) and authentified write access (git push) to a git bare repository via HTTP/HTTPS over an Apache2 web-server 2.4.29.
I try out the documented configuration (https://git-scm.com/docs/git-http-backend):
SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
... in both variants ...
Variant 1) With module mod_rewrite:
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"
AuthBasicProvider ldap
AuthLDAPURL ldap://ldapserver:386
Require user test
Satisfy Any
</LocationMatch>
Variant 2: Without module mod_rewrite:
<LocationMatch "^/git/.*/git-receive-pack$">
AuthType Basic
AuthName "Git Access"
AuthBasicProvider ldap
AuthLDAPURL ldap://ldapserver:386
Require user test
</LocationMatch>
<LocationMatch "^/git/">
Require all granted
Allow from all
</LocationMatch>
I am using debian package apache2 (2.4.29-1ubuntu4.14) on server side and git 2.29.2 on client side to test the configuration.
Both variants are not working.