Make Gitweb behave like Apache mod_userdir

6 messages, 3 authors, 2016-06-15 · open the first message on its own page

Make Gitweb behave like Apache mod_userdir

From: Sylvain Rabot <hidden>
Date: 2016-06-15 22:47:43

Hello,

I contact you because I spent quite some time to make something pretty
basic with gitweb.
I made gitweb behave a bit like UserDir module will in apache.
In fact it's only configuration but I think it could be useful to others.

Basicly it allows users of your server who use git to be able to use
gitweb to browse their own root project. E.G. :

Alice's private repos :

/home/alice/git/product_a.git (cloned from /var/git/product_a.git)
/home/alice/git/product_b.git (cloned from /var/git/product_b.git)
/home/alice/git/product_c.git (cloned from /var/git/product_c.git)

Alice's links to her repos which she wants to be able to browse with gitweb :

/home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
/home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git

Bare repos :

/var/git/product_a.git
/var/git/product_b.git
/var/git/product_c.git
/var/git/product_d.git

/etc/gitweb.conf :

$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/git/";

Apache configuration :

RewriteRule ^/~([^\/]+)/?$  /cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]

So now all users with a gitweb folder in their home will be able to
browse all git repos in it through http://<host>/~<user>.

You will find a patch enclosed which try to describe best what I did
and why in the gitweb/README.

Regards.

Re: Make Gitweb behave like Apache mod_userdir

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:43

Sylvain Rabot [off-list ref] writes:
I made gitweb behave a bit like UserDir module will in apache.
In fact it's only configuration but I think it could be useful to others.
Thanks.  Any comment from gitweb gangs?
Basicly it allows users of your server who use git to be able to use
gitweb to browse their own root project. E.G. :

Alice's private repos :

/home/alice/git/product_a.git (cloned from /var/git/product_a.git)
/home/alice/git/product_b.git (cloned from /var/git/product_b.git)
/home/alice/git/product_c.git (cloned from /var/git/product_c.git)

Alice's links to her repos which she wants to be able to browse with gitweb :

/home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
/home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git

Bare repos :

/var/git/product_a.git
/var/git/product_b.git
/var/git/product_c.git
/var/git/product_d.git

/etc/gitweb.conf :

$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/git/";

Apache configuration :

RewriteRule ^/~([^\/]+)/?$ /cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]

So now all users with a gitweb folder in their home will be able to
browse all git repos in it through http://<host>/~<user>.

You will find a patch enclosed which try to describe best what I did
and why in the gitweb/README.

Re: Make Gitweb behave like Apache mod_userdir

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:47:44

On Sun, 15 Nov 2009, Junio C Hamano wrote:
Sylvain Rabot [off-list ref] writes:
quoted
I made gitweb behave a bit like UserDir module will in apache.
In fact it's only configuration but I think it could be useful to others.
Thanks.  Any comment from gitweb gangs?
I would respond earlier if it was submitted with patch inline in mail
body, and not attached.  If it needs to be attached (because of MUA/MTA
linewrapping or encoding issues), it should use 8bit and not base64
content transfer encoding, have 'text/plain' and not 
'application/octet-stream' content type, and "inline" and not "attachement"
in content disposition.

It also lacks proper commit message (although email describes it quite
well) and signoff, as per Documentation/SubmittingPatches.

I like this patch.  More examples in gitweb/README are always good idea.
quoted
Basicly it allows users of your server who use git to be able to use
"Basically"
quoted
gitweb to browse their own root project. E.G. :
"For example"
quoted
Alice's private repos :

/home/alice/git/product_a.git (cloned from /var/git/product_a.git)
/home/alice/git/product_b.git (cloned from /var/git/product_b.git)
/home/alice/git/product_c.git (cloned from /var/git/product_c.git)

Alice's links to her repos which she wants to be able to browse with gitweb :
"Alice links", or "Alice creates symbolic links"
quoted
/home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
/home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git

Bare repos :

/var/git/product_a.git
/var/git/product_b.git
/var/git/product_c.git
/var/git/product_d.git
The description is a bit lacking.  Where user should put theirs git
repositories, or symbolic links to git repositories?  How it would
look like in gitweb?

-- 
Jakub Narebski
Poland

Re: Make Gitweb behave like Apache mod_userdir

From: Sylvain Rabot <hidden>
Date: 2016-06-15 22:47:44

On Tue, Nov 17, 2009 at 14:58, Jakub Narebski [off-list ref] wrote:
On Sun, 15 Nov 2009, Junio C Hamano wrote:
quoted
Sylvain Rabot [off-list ref] writes:
quoted
I made gitweb behave a bit like UserDir module will in apache.
In fact it's only configuration but I think it could be useful to others.
Thanks.  Any comment from gitweb gangs?
I would respond earlier if it was submitted with patch inline in mail
body, and not attached.  If it needs to be attached (because of MUA/MTA
linewrapping or encoding issues), it should use 8bit and not base64
content transfer encoding, have 'text/plain' and not
'application/octet-stream' content type, and "inline" and not "attachement"
in content disposition.
Sorry about that but I'm new in the git world and it is the first time
I submit a patch.
It also lacks proper commit message (although email describes it quite
well) and signoff, as per Documentation/SubmittingPatches.

I like this patch.  More examples in gitweb/README are always good idea.
quoted
quoted
Basicly it allows users of your server who use git to be able to use
"Basically"
Oops
quoted
quoted
gitweb to browse their own root project. E.G. :
"For example"
quoted
quoted
Alice's private repos :

/home/alice/git/product_a.git (cloned from /var/git/product_a.git)
/home/alice/git/product_b.git (cloned from /var/git/product_b.git)
/home/alice/git/product_c.git (cloned from /var/git/product_c.git)

Alice's links to her repos which she wants to be able to browse with gitweb :
"Alice links", or "Alice creates symbolic links"
quoted
quoted
/home/alice/gitweb/product_a -> /home/alice/git/product_a.git/.git
/home/alice/gitweb/product_c -> /home/alice/git/product_c.git/.git

Bare repos :

/var/git/product_a.git
/var/git/product_b.git
/var/git/product_c.git
/var/git/product_d.git
The description is a bit lacking.  Where user should put theirs git
repositories, or symbolic links to git repositories?
As I said It's only configuration so It depends of your server
architecture. If admin of the server decides he allows users to browse
via gitweb their private/public repos which are linked in
/home/*/.gitweb or anything else he has to modify the environmental
variable in the rewrite rule according to his wish.
How it would look like in gitweb?
What do you mean ?
--
Jakub Narebski
Poland

Re: Make Gitweb behave like Apache mod_userdir

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:47:44

On Tue, 17 Nov 2009, Sylvain Rabot wrote:
On Tue, Nov 17, 2009 at 14:58, Jakub Narebski [off-list ref] wrote:
quoted
The description is a bit lacking.  Where user should put theirs git
repositories, or symbolic links to git repositories?
As I said It's only configuration so It depends of your server
architecture. If admin of the server decides he allows users to browse
via gitweb their private/public repos which are linked in
/home/*/.gitweb or anything else he has to modify the environmental
variable in the rewrite rule according to his wish.
So in described configuration, to make repository visible user would have
to put repository, or symbolic link to repository (or .git/ directory of
the repository) in ~/gitweb/ directory (just like one would need to put
HTML files in ~/public_html/ or ~/WWW/ to have them visible as web site),
isn't it?
quoted
How it would look like in gitweb?
What do you mean ?
How would example gitweb URL to repository look like?

-- 
Jakub Narebski
Poland

Re: Make Gitweb behave like Apache mod_userdir

From: Sylvain Rabot <hidden>
Date: 2016-06-15 22:47:44

On Tue, Nov 17, 2009 at 19:12, Jakub Narebski [off-list ref] wrote:
On Tue, 17 Nov 2009, Sylvain Rabot wrote:
quoted
On Tue, Nov 17, 2009 at 14:58, Jakub Narebski [off-list ref] wrote:
quoted
quoted
The description is a bit lacking.  Where user should put theirs git
repositories, or symbolic links to git repositories?
As I said It's only configuration so It depends of your server
architecture. If admin of the server decides he allows users to browse
via gitweb their private/public repos which are linked in
/home/*/.gitweb or anything else he has to modify the environmental
variable in the rewrite rule according to his wish.
So in described configuration, to make repository visible user would have
to put repository, or symbolic link to repository (or .git/ directory of
the repository) in ~/gitweb/ directory (just like one would need to put
HTML files in ~/public_html/ or ~/WWW/ to have them visible as web site),
isn't it?
That's right.
quoted
quoted
How it would look like in gitweb?
What do you mean ?
How would example gitweb URL to repository look like?
http://repo.or.cz/ -> list the main GITWEB_PROJECTROOT (e.g.: /pub/scm)
http://repo.or.cz/~user -> list /home/user/gitweb
http://repo.or.cz/~user2 -> list /home/user2/gitweb
...
--
Jakub Narebski
Poland
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help