In Ubuntu the file /usr/share/gitweb/gitweb.cgi
shouldn’t be edited. The $projectroot
variable should be set in /etc/gitweb.conf
.
Thanks to the Git’s mailing list for the help.
문제
After installing gitweb on an Ubuntu 12.04 (64 bit) server and changing the variable $projectroot
in /usr/share/gitweb/gitweb.cgi
to any directory other than /var/cache/git
, projects are still searched in /var/cache/git
.
This happens with Ubuntu’s gitweb package (1.7.9.5) and also cloning Git’s repository and compiling the latest stable branch (1.8.0.1).
The problem can be also experienced as a "404 - no projects found" on Apache’s gitweb site, because projects would be in a directory different to /var/cache/git
.
해결책
In Ubuntu the file /usr/share/gitweb/gitweb.cgi
shouldn’t be edited. The $projectroot
variable should be set in /etc/gitweb.conf
.
Thanks to the Git’s mailing list for the help.
다른 팁
After defining $projectroot=/var/git
(as is my case), if I inserted the value of $projectroot
in the <title>
in line 3,915, the string /var/cache/git
was being displayed, so the issue is that somewhere along the cgi file the value of $projectroot
was reset to the system’s default.
The culprit of this behaviour lies in the git_get_projects_list
subroutine where, in line 2,865, the global variable our $projectroot
is defined once again, resetting its value to the system’s default. The way to solve it is, on that same line, to declare it and set it to the same value as above:
...
2,863. # global variables
2,864. our $project_maxdepth = 2007;
2,865. our $projectroot = "/var/git";
2,866. # skip project-list toplevel, if we get it.
2,867. return if (m!^[/.]$!);
...
I haven’t seen this issue reported in Ubuntu’s or Git’s mailing lists, so any insight as if this is a bug or a feature (it looks clearly as a bug to me, though), or if this happens in other Linux distributions, will be greatly appreciated.