I am having trouble setting up git instaweb on OpenSUSE Tumbleweed.
I did install git-web
and lighttpd
.
When I do git instaweb
in the root of my git project, the browser opens in a page that says No such projects found
.
I tryed to put the project root in /srv/git
but it also did not work.
This should be as simple as doing these commands in the project root:
git instaweb
and
git instaweb --stop
To solve this issue, I have noticed that the command git instaweb
creates a folder under .git
called gitweb
. In this folder we can find a configuration file for lighttpd
called lighttpd.conf
and another for gitweb.cgi
called gitweb_config.perl
.
Assuming you are in the root of the project, it is possible to run lighttpd
"by hand" like this:
lighttpd -D -f .git/gitweb/lighttpd.conf
-f
specifies the lighttpd
configuration file.-D
tells lighttpd
not to daemonize.When I access the browser page, I get on the console:
[Fri Jan 5 17:51:35 2024] gitweb.cgi: Can't exec "/usr/bin/git": Permission denied at /usr/share/gitweb/gitweb.cgi line 3335.
It seems to be a problem with /usr/bin/git
. I tried to add the following line to /etc/apparmor.d/usr.share.git-web.gitweb.cgi
:
/usr/bin/git rix,
But it still did not work. After some searching I found a way to debug AppArmor
:
grep -i apparmor\=\"DENIED\" /var/log/audit/audit.log | less
...
type=AVC msg=audit(1704485570.756:138288): apparmor="DENIED" operation="exec" class="file" profile="gitweb.cgi" name="/usr/libexec/git/git" pid=31445 comm="gitweb.cgi" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
So I deleted the previously added line to /etc/apparmor.d/usr.share.git-web.gitweb.cgi
and added the following line:
/usr/libexec/git/git rix,
Now it works fine.