Can't view files when browsing repository

Attempting to view the contents of a file stored in a GIT repo results in the error 403 Forbidden - Open failed.

I've attached screenshots with highlighted links in order to reproduce the issue. In short, navigate to: services ----> git repositories ----> Browse Repository. A new browser window or tab will open with the repository browser displayed. Click on "tree" at the top of the page. A list of files stored in the repository are displayed. Click "Blob". Instead of showing the contents of the file, the error 403 Forbidden - Open failed. is displayed.

The Apache error log is:

[Thu Jan 25 16:36:16.500737 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1193., referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:16.500878 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:16.501216 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1246., referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:16.501328 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:16.502001 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1324., referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:16.502086 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:16.502710 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1376., referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:16.502783 2018] [cgi:error] [pid 24400] [client ] AH01215: [Thu Jan 25 16:36:16 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible%2Egit
[Thu Jan 25 16:36:30.186616 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1193., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.186734 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.188659 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1246., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.188743 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.188827 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1324., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.188870 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.188917 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: defined(@array) is deprecated at gitweb.cgi line 1376., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.188959 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: \t(Maybe you should just omit the defined()?), referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.203228 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: Use of uninitialized value $suffix in substitution (s///) at gitweb.cgi line 1447., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.203354 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: Use of uninitialized value $ext in regexp compilation at gitweb.cgi line 1448., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.210385 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: Use of uninitialized value $ext in pattern match (m//) at gitweb.cgi line 1457., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
[Thu Jan 25 16:36:30.212190 2018] [cgi:error] [pid 27094] [client ] AH01215: [Thu Jan 25 16:36:30 2018] gitweb.cgi: Can't exec "highlight": No such file or directory at gitweb.cgi line 1477., referer: https://domain.com/git/gitweb.cgi?p=ansible.git;a=tree
Status: 
Closed (fixed)

Comments

In addition the link to download a snapshot doesn't work. Clicking on "snapshot" results in the following error: /git/ansible.git-snapshot-2a00916c8931f1600a6a72e02bc7959801b118be.tar.bz2

Does this happen for all files, and also does it only happen when Blob is clicked on?

It happens no matter the file type, binary or text on all files. It only happens when Blob or "snapshot" is clicked on.

It looks like you're relying on a custom gitweb script rather than what's provided by yum. Is there a specific reason for doing it this way?

I found that copying the contents of the yum provided gitweb (/var/www/git/) to ~/public_html/git fixes all the issues I was having. In addition, since gitweb isn't a modified script, third party templates work correctly.

After copying /var/www/git/ which includes the static directory the /git directory looks like this:

~/public_html/git/gitweb.cgi
~/public_html/git/static

I then copied /etc/gitweb.conf to ~/public_html/git/gitweb_config.perl and modified our $projectroot to our $projectroot = "/home/sandbox/public_html/git";

Wouldn't it be easier to simply copy the gitweb script and modify gitweb_config.perl with the correct parameters? Doing it this way would allow users to customize their gitweb install by changing parameters in gitweb_config.perl.

We use the distro-provided gitweb.cgi script if Virtualmin can find it. Where is this file on your system?

I didn't have gitweb installed when I created the repo so that explains why it wasn't using the distro provided version. On centos its installed in /var/www/html/git

Or /var/www/git....i don't recall exactly

Actually I was wrong - on CentOS 7, we are't using the distro-provided gitweb even though we could.

This will be fixed in the next release of the Git plugin for Virtualmin.

I think it wold make sense to include the gitweb package as part of the initial install script or as a dependency of wbm-virtualmin-git. The current documentation states that one should install gitweb manually.

Status: Fixed ยป Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.