No authentication done but request not allowed without authentication for /test-repo.git

I am trying to set up authentication to my Git repo in Apache. My config looks as follows:
<Directory "/var/www/git-repos">
Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi

AuthUserFile "/etc/apache2/passwd.git"
Require valid-user
</Directory>

However, when I try to access the repository in my browser, I get response code 500 - internal server error. My Apache logs say:
No authentication done but request not allowed without authentication for /test-repo.git/. Authentication not configured?

What can be the issue?
graham on 19-06-2015 12:37
Turns out I forgot to put:
AuthType Basic
AuthName "git"

in my config. So now my config looks like this:
<Directory "/var/www/git-repos">
Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi

AuthType Basic
AuthName "git"
AuthUserFile "/etc/apache2/passwd.git"
Require valid-user
</Directory>
graham on 19-06-2015 12:38

Post an answer

Do you have a solution to this problem, or want to comment on it? Other users will appreciate your help!
Your answer or comment:
Show formatting hints
HTML is disallowed, but in your text you can use the following markup
  • [code][/code] for a block of code
  • [tt][/tt] for inline code
  • [link]link href|link anchor[/link] for links
  • [b][/b] for bold text
+ Ask a question
If you have a technical question related to programming and computers, ask it here. Other users will help you solve it!
Unanswered questions
Share your knowledge by helping others solve their problems