Trying to access invalid directory

Michael Durian durian at
Thu May 13 19:39:02 UTC 2021

I’m seeing errors like the following appear in my log file:

[Thu May 13 12:59:33.740795 2021] [authz_core:error] [pid 67752] [client] AH01630: client denied by server configuration: /ebs1/git/src, referer:

I think rather than trying to access /ebs1/git/src, it should be trying to access /ebs1/git/moca/src. I’m guessing there is a way I can correct this using macro substitutions, but I’m not sure what configuration value needs to be adjusted.

Here’s what I’m trying to do. I’m using apache authentication to restrict access to different git areas. Each area has its own .htpasswd. Basically, if you are trying to access /moca, you need to authenticate. The same LocationMatch block that handles the authentication defines REPO_NAME and SCANPATH environment variables that I then use in the cgitrc file. What should I adjust to keep cgit from trying to access the wrong filesystem path? Or am I thinking about this all wrong and should take a different approach completely?

Excerpts from my VirtualHost definition:
	DocumentRoot /ebs1/git

        <LocationMatch ^/moca>
                AuthType Basic
                AuthName 'Git Access'
                AuthUserFile /ebs1/git/moca/.htpasswd
                Require valid-user
                Order allow,deny
                Allow from all

                # Let cgit know where to search for repositories.
                # This value is passed to cgitrc where it is used
                # to for the scan-path variable.
                SetEnv REPO_NAME moca
                SetEnv SCANPATH /ebs1/git/moca

        SetEnv GIT_PROJECT_ROOT /ebs1/git
        ScriptAliasMatch \
                "(?x)^/(.*/(HEAD | \
                           info/refs | \
                           objects/info/[^/]+ | \
                           git-(upload|receive)-pack))$" \

        # For cgit
        SetEnv CGIT_CONFIG /ebs1/git/cgit/cgitrc
        <Directory /ebs1/git/cgit>
                AllowOverride None
                Options +ExecCGI
                Require all granted
        Alias /cgit.png /ebs1/git/cgit/cgit.png
        Alias /cgit.css /ebs1/git/cgit/cgit.css
        Alias /favicon.ico /ebs1/git/cgit/favicon.ico
        ScriptAlias /moca /ebs1/git/cgit/cgit.cgi

And here’s my /ebs1/git/cgit/cgitrc


More information about the CGit mailing list