문제

I have a functioning git repository on my CentOs 5.5 server. I want a web user interface for my repositories using gitweb.

I installed gitweb using the instructions at http://git-scm.com/book/ch4-6.html and I manage to have my apache server to run the cgi properly. I put my repositories in /pub/git and created the gitweb.conf file in /etc/ with the line $projectroot = '/pub/git';. Unfortunately, I can't see my repositories and the webpage shows the message "No such projects found", which I googled without success.

I tried to add the line $projects_list = '/pub/git/projects.list'; to the gitweb.conf and created the file projects.list with the name of my repositories (e.g. repos1.git). Nothing changes. If I put the name of a repository that does not exist in /pub/git, the webpage shows the more popular and investigated error message "404 - No projects found".

Notice that the apache user can access all the files and repositories.

The content of my /etc/gitweb.conf is:

$projectroot = '/pub/git';
$projects_list = '/pub/git/projects.list';

Thanks!

도움이 되었습니까?

해결책

I solved my own problem, and I thought I would post the solution in case someone else comes across this.

It turns out that gitweb could simply not find the git executable. In other words, the make instructions make GITWEB_PROJECTROOT="/path/to/git/git" shown in http://git-scm.com/book/ch4-6.html is not sufficient.

The reason why it took me so long to figure this out is because one would expect another type of problem coming up, not just an empty list of repositories! It seems like in order to show the latest commit message gitweb runs git rev-list on the project. When it can't find git, it simply gives up on listing the projects. All I had to do was adding the line $GIT = '/path/to/git/git'; to my gitweb.conf.

Cheers!

다른 팁

I hit the same problem on bluehost.com and providing full path to git binary doesn't help, but as it stated in the gitweb.cgi comments "this can just be "git" if your webserver has a sensible PATH" cured this problem, so all one need to fix it is:

our $GIT = "git";

either in gitweb.cgi itself or in "gitweb_config.perl"

I thought projectroot was defined in gitweb.conf -- but it was also hard-coded into gitweb.cgi. Perhaps, gitweb.conf is not being sourced in my implementation. Regardless, I edited gitweb.cgi to our $projectroot = /home/git and that fixed it for me.

If you already have created repos, and then install gitweb, then the protection of the repos may be wrong. My initial UMASK was 077 so all my repos are only accessible by the git user.

When I did:

cd /home/git
chmod -R 750 repositories

and added www-data to the "git" group:

usermod -a -G  git www-data

I got it working.

I also hit this problem on CentOS 6.4 and just wanted to add my solution to this thread.

For me the issue was that SELinux was enabled. This was blocking the httpd process from accessing my repository directory even if I chmod 777 on it.

For me, just disabling SELinux solved the problem. If disabling is not an option, then you'll need to look at how to configure SELinux to allow httpd to access your repository directory.

  1. check file permissions for $projectroot
    • is everything readable/traversable by apache or nginx?
  2. check /etc/gitweb.conf
    • I had to change $projectroot and $project_list in both places
  3. check /var/www/git/gitweb.cgi
    • I had to change $projectroot and $project_list in both places
  4. is your project exported?
    • check /path/to/project.git/git-daemon-export-ok
  5. check selinux policy

For CentOS6 server that I just configured for gitweb, it is SELinux caused it.

setnforce 0

fixed the issue

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top