1

I'm trying to get gitweb setup on a CentOS 6.2 server with git/gitweb 1.7.1 and httpd 2.2.15 installed.

gitweb's default project root (verified in the CGI script) is /var/lib/git, so I've created that and a bare git repository in there:

$ ls -laF /var/lib/git
total 12
drwxrwxr-x.  3 git  git  4096 Feb  8 16:37 ./
drwxr-xr-x. 15 root root 4096 Feb  8 14:20 ../
drwxrwxr-x.  7 git  git  4096 Feb  8 15:37 foo/

$ git init --bare --shared foo
Initialized empty shared Git repository in /var/lib/git/foo/

$ ls -lF foo
total 32
drwxrwsr-x. 2 git git 4096 Feb  8 17:16 branches/
-rw-rw-r--. 1 git git  126 Feb  8 17:16 config
-rw-rw-r--. 1 git git   73 Feb  8 17:16 description
-rw-rw-r--. 1 git git   23 Feb  8 17:16 HEAD
drwxrwsr-x. 2 git git 4096 Feb  8 17:16 hooks/
drwxrwsr-x. 2 git git 4096 Feb  8 17:16 info/
drwxrwsr-x. 4 git git 4096 Feb  8 17:16 objects/
drwxrwsr-x. 4 git git 4096 Feb  8 17:16 refs/

$ cat foo/HEAD
ref: refs/heads/master

However on viewing http://localhost/git/, I see "404 No projects found".

I've debugged through the script and can see that it's finding /var/lib/git/foo, but Perl's -e operator fails on /var/lib/git/foo/HEAD. At the same place in the file, a backticked call to ls shows that the file is visible there, but I cannot make Perl -e see the file.

Any idea what might be making this fail? This makes no sense to me.

EDIT: note that SELinux extensions on this CentOS box appear to be disabled:

$ sudo sestatus
SELinux status:                 disabled

EDIT: moving everything from /var/lib/git to /git hasn't helped. I've changed the apache user to have a real shell, logged in as that user, and verified that it has access to all the directories and files in question.

Alan Krueger
  • 4,701
  • 4
  • 35
  • 48
  • Any extra steps that might helpful on this tutorial? (http://bcaccinolo.wordpress.com/2010/12/28/gitweb-configuration-the-easy-way/) Or... maybe something from this forum post? (http://ubuntuforums.org/showthread.php?t=1536963) It could possibly be related to needing to `chmod a+x` that parent directory... like one of the posters on that forum discovered. Also... it's CentOS; I wonder if this has to do with any SELinux stuff, again... – summea Feb 08 '12 at 23:25
  • @summea Those two pop up in related Google searches, so I read them a couple hours ago. Thanks for the nostalgic look back, though. – Alan Krueger Feb 08 '12 at 23:50
  • It's probably not SELinux, that's currently disabled. Edited text above to reflect that. – Alan Krueger Feb 09 '12 at 00:25
  • Any way you can post (at least part of,) the HEAD file? – summea Feb 09 '12 at 00:32
  • @summea added it to the quoted terminal session at the bottom. It's a fresh, bare repo with nothing in it, since I created it during that terminal session. – Alan Krueger Feb 09 '12 at 00:38
  • Hmm... well, I've edited my earlier non-answer; someone else seemed to have a similar problem (noted in the link in the edited answer below.) – summea Feb 09 '12 at 01:19

2 Answers2

2

It was in fact SELinux. Even though SELinux reported it was disabled, it was somehow preventing access to some files for CGI scripts running under httpd. Enabling SELinux and setting it to permissive mode, it started working.

This seems highly non-intuitive and frustrates me, but at least it's working.

Alan Krueger
  • 4,701
  • 4
  • 35
  • 48
  • Alan Kruger's suggestion of setting SELinux to permissive mode worked for me also. In CentOs I used the command 'setenforce 0'. But for security reasons, this is only a temporary solution. – user64141 Jan 28 '13 at 22:11
0

I'm still thinking it's an issue with permissions... but I could be wrong. Have you ensured that all of the parent directories leading up to your /var/lib/git directory are permission-accessible?

Someone else had a similar problem here and it might be worth trying a completely different directory... maybe even /opt.

Community
  • 1
  • 1
summea
  • 7,390
  • 4
  • 32
  • 48
  • Yes, I already tried that, which is exactly why I gave the long directory listing: so you could see that the execute bits are set. – Alan Krueger Feb 08 '12 at 23:48
  • I've also tried moving the whole thing to a branch new tree, `/git`, changing `/etc/gitweb.conf` to match. No luck. – Alan Krueger Feb 09 '12 at 15:16
  • And you restarted (stopped/started) `httpd`? – summea Feb 09 '12 at 16:26
  • Weird; just trying to help troubleshoot... but, have you tried putting any other sort of web page... or web app on your webserver public directory to just see if that can be accessed? – summea Feb 09 '12 at 17:21