gitosis is a tool for simple hosting of git repositories and managing access to them. gitweb has capabilities to control which repositories are listed on the project list page – $strict_export, $export_auth_hook and some other friends. in my case, everyone accessing web resources are authenticating through apache, which in turn connects to an LDAP server.
Here is a guide for setting up gitosis.
Q: how to provide gitweb access only to those repositories to which the apache user has been granted access in gitosis.conf?
This is modified source of gitweb_auth.
Make sure you match up your Apache names, ssh public keyfile names and gitosis ‘writable’ names.
Note: you may want to check out gitolite, an enhanced gitosis.