Bug 561284 - Provide additional gitweb configuration directives
Summary: Provide additional gitweb configuration directives
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: git
Version: 12
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Chris Wright
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-02-03 09:34 UTC by Daniel Qarras
Modified: 2013-01-10 10:38 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-03 23:24:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Daniel Qarras 2010-02-03 09:34:31 UTC
Description of problem:
After spending an hour and still failing to get the following to work on my F12/gitweb installation I thought perhaps these commonly used directives could be added to /etc/httpd/conf.d/git.conf (in comments, if more feasible):

- how to enable pretty URLs (ie http://host.example.com/git/project.git)
- how to enable gitweb and git pull via http at the same time

Thanks.

Comment 1 Todd Zullinger 2010-02-03 14:42:51 UTC
Have you checked out the git-1.6.6.1-1 package in updates-testing? That includes the gitweb INSTALL file and an example gitweb.conf which points to the README and INSTALL file for further infomation.

I'm not sure that adding a lot of example configurations is something we should be doing in our packages. It properly belongs upstream IMO (even the exampel gitweb.conf that I added should be something that comes from upstream). I don't know that I'll have time to work on pushing that upstream in the near-term, but if you (or anyone else reading) is interested in helping do so, it would be most welcome. To paraphrase an old saying, "patches speak louder than bug reports." :) The git list is at git.org.

All that said, I believe there are several ways to achieve the goal you want.  I found that using Apache's RewriteEngine worked well in the least amount of time with a little bit of reading.

# cat /etc/httpd/conf.d/git.conf 
Alias /git /var/www/git

<Directory /var/www/git>
  Options +ExecCGI
  AddHandler cgi-script .cgi
  DirectoryIndex gitweb.cgi

  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^.* /git/gitweb.cgi/$0 [L,PT]
</Directory>

# tail /etc/gitweb.conf
$feature{'pathinfo'}{'default'} = [1];

# URI of stylesheets
our @stylesheets = ("http://localhost/git/gitweb.css");
# URI of GIT logo (72x27 size)
our $logo = "http://localhost/git/git-logo.png";
# URI of GIT favicon, assumed to be image/png type
our $favicon = "http://localhost/git/git-favicon.png";
# URI of gitweb.js (JavaScript code for gitweb)
our $javascript = "http://localhost/git/gitweb.js";

Comment 2 Daniel Qarras 2010-02-03 19:51:28 UTC
Thanks for taking the time to inspect this one, appreciated. I might well post a patch once I have something that actually works :-)

Your solution is nice and I can confirm that it works well for enabling pretty URLs. One possibility I had was to have:

# cat /etc/httpd/conf.d/git.conf 
Alias /gitweb.css /var/www/git/gitweb.css
Alias /git-logo.png /var/www/git/git-logo.png
Alias /git-favicon.png /var/www/git/git-favicon.png

ScriptAlias /git /var/www/git/gitweb.cgi

<Directory /var/www/git>
  Options +ExecCGI
  AddHandler cgi-script .cgi
  DirectoryIndex gitweb.cgi
  RewriteEngine on
  # redirect userdir listing to gitweb search
  RewriteRule ^/?(~[^/]+)/?$ /?s=$1 [R]
  # rewrite all other paths that aren't git repo internals to gitweb
  RewriteRule ^/$ /git [PT]
  RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /git%{REQUEST_URI} [L,PT]
</Directory>

# tail -1 /etc/gitweb.conf
$feature{'pathinfo'}{'default'} = [1];

However, neither of these seem enable cloning over http:

# git clone http://localhost/git/testrepo.git testrepo.git
Initialized empty Git repository in /tmp/testrepo.git/.git/
warning: remote HEAD refers to nonexistent ref, unable to checkout.

I'd presume that running git update-server-info once manually and then in the post-update hook is enough for a repository and the rest is a matter of configuring httpd.conf but for one reason or another this won't work with the configurations presented above.

Thanks.

Comment 3 Daniel Qarras 2010-04-05 16:31:31 UTC
Not sure what shall we do with this? I could try to dig the directives by myself again but given the fact that I've already failed twice I'm afraid I won't make any progress here.

Comment 4 Daniel Qarras 2010-10-11 06:58:27 UTC
I've now investigated this with Fedora 14 using

git-1.7.3.1-1.fc14.i686
gitweb-1.7.3.1-1.fc14.noarch

and now both Gitweb and cloning over HTTP work with the following git.conf using git-http-backend:

# Basic configuration
SetEnv GIT_PROJECT_ROOT /var/lib/git
SetEnv GIT_HTTP_EXPORT_ALL

# Serve static files directly
AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /var/lib/git/$1
AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1

# Serve repository objects with Git HTTP backend
ScriptAliasMatch \
        "(?x)^/git/(.*/(HEAD | \
                        info/refs | \
                        objects/info/[^/]+ | \
                        git-(upload|receive)-pack))$" \
        /usr/libexec/git-core/git-http-backend/$1

# Serve HTML with Gitweb
Alias /git /var/www/git
<Directory /var/www/git>
  Options +ExecCGI
  AddHandler cgi-script .cgi
  DirectoryIndex gitweb.cgi
</Directory>

# Enable anonymous read access but authenticated write access
#<LocationMatch "^/git/.*/git-receive-pack$">
#    AuthType Basic
#    AuthName "Git Access"
#    Require group committers
#</LocationMatch>

# Require authentication for both reads and writes
#<Location /git/private>
#    AuthType Basic
#    AuthName "Private Git Access"
#    Require group committers
#</Location>

Everything above is basically from git-http-backend man page except the Alias rule which is used to replace a ScriptAlias rule mentioned in the man page which did not work with Gitweb.

Perhaps git.conf could be updated to use git-http-backend?

In any case, I think this bug could be closed, this was not really a bug report but a suggestion and now that the suggestion is above, it's only matter of either adopting it or not and in both cases the bug can be closed :)

Thanks!

Comment 5 Bug Zapper 2010-11-03 23:11:44 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 6 Bug Zapper 2010-12-03 23:24:08 UTC
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.