Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top