You might want to protect a gitweb instance with authentication like i did. Here is how. This was done on Debian. Most distributions should have the file in the same locations.
The htpasswd file
Note that you will have to replace $USER with your desired user name:
#Add another user(optional)
#Delete a user(notice)
service apache2 restart