Gitweb: Scan dir for repos & show these other specified repos
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
Is it possible to have gitweb show all repositories in /path/to/wherever and also show some other repositories at particular locations like /home/user/git/repo1 and /home/user2/git/repo2 ? Or better yet, scan multiple dirs? Currently I can only see how to do one or the other within a single gitweb installation. I suppose I could run two of them...
Thanks for the help.
- -Mike
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkuMEmQACgkQst0AR/DaKHuYiQCeL3EoeUCr676lbwE2PIZK2tk3 7dsAoMpBmKoZZj3LV1zKLVqtIpFIiIii
=YDlg
-----END PGP SIGNATURE-----
Quoted 5 lines · Mike.lifeguard
Is it possible to have gitweb show all repositories in /path/to/wherever and also show some other repositories at particular locations like
/home/user/git/repo1and/home/user2/git/repo2? Or better yet, scan multiple dirs? Currently I can only see how to do one or the other within a single gitweb installation. I suppose I could run two of them...
It is not possible with $projects_list being directory (or undefined, which means to take $projectroot), but I think it is possible with $projects_list being a file.
You would have to set $projectroot to common prefix (it might be empty, i.e. '' if there is no common prefix), then list there all repositories, relative to $projectroot. See gitweb/README and gitweb/INSTALL, and comments in gitweb.perl for details on file format.
P.S. It probably be a good idea to have something like mod_userdir, but gitweb currently doesn't support something like that.
P.P.S. Alternate solution would be to try to work around it with automount / autofs or something like that.
Signature · 3 lines
Jakub Narebski Poland ShadeHawk on #git
Quoted 19 lines · Jakub Narebski
Quoted 5 lines · Mike.lifeguard
Is it possible to have gitweb show all repositories in /path/to/wherever and also show some other repositories at particular locations like
/home/user/git/repo1and/home/user2/git/repo2? Or better yet, scan multiple dirs? Currently I can only see how to do one or the other within a single gitweb installation. I suppose I could run two of them...It is not possible with $projects_list being directory (or undefined, which means to take $projectroot), but I think it is possible with $projects_list being a file.
You would have to set $projectroot to common prefix (it might be empty, i.e. '' if there is no common prefix), then list there all repositories, relative to $projectroot. See gitweb/README and gitweb/INSTALL, and comments in gitweb.perl for details on file format.
Quoted 2 lines
P.S. It probably be a good idea to have something likemod_userdir, but gitweb currently doesn't support something like that.
I had the same problematic some times ago. I wanted to have several project's roots folder for gitweb (one for each unix user of the server).
You can find the discussion here :
http://thread.gmane.org/gmane.comp.version-control.git/132926/
http://marc.info/?t=125827961600002&r=1&w=2
Here the configuration I used :
/etc/gitweb.conf :
$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/var/gitweb";
/etc/apache2/sites-available/yourvirtualhost :
RewriteEngine on
RewriteRule ^/$ /cgi-bin/gitweb.cgi [QSA,L,PT]
RewriteRule ^/\~([^\/]+)/?$ /cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]
I.E. :
http://yourvirtualhost/ will have /var/gitweb as proeject root
http://yourvirtualhost/~<user>/ will have /home/<users>/gitweb as proeject root
You can modify the rewrite rule to match what you want to do.
Quoted 3 lines
P.P.S. Alternate solution would be to try to work around it with automount / autofs or something like that.
Signature · 1 line
Sylvain Rabot <[email protected]>
Quoted 34 lines · Sylvain Rabot
Quoted 10 lines · Jakub Narebski
Quoted 5 lines · Mike.lifeguard
Is it possible to have gitweb show all repositories in /path/to/wherever and also show some other repositories at particular locations like
/home/user/git/repo1and/home/user2/git/repo2? Or better yet, scan multiple dirs? Currently I can only see how to do one or the other within a single gitweb installation. I suppose I could run two of them...
P.S. It probably be a good idea to have something likemod_userdir, but gitweb currently doesn't support something like that.I had the same problematic some times ago. I wanted to have several project's roots folder for gitweb (one for each unix user of the server).
You can find the discussion here :
http://thread.gmane.org/gmane.comp.version-control.git/132926/
http://marc.info/?t=125827961600002&r=1&w=2Here the configuration I used :
/etc/gitweb.conf:$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "
/var/gitweb";
/etc/apache2/sites-available/yourvirtualhost:RewriteEngine on
RewriteRule ^/$ /cgi-bin/gitweb.cgi [QSA,L,PT]
RewriteRule ^/\~([^\/]+)/?$ /cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]
Quoted 7 lines
I.E. :
http://yourvirtualhost/ will have
/var/gitwebas proeject root
http://yourvirtualhost/~<user>/ will have /home/<users>/gitweb as proeject rootYou can modify the rewrite rule to match what you want to do.
Would you mind writing it up and adding it as an example in gitweb/README? If you don't have time, I can try to do this myself in my free time.
Signature · 2 lines
Jakub Narebski Poland
Quoted 37 lines · Jakub Narebski
Quoted 36 lines · Sylvain Rabot
Quoted 10 lines · Jakub Narebski
Quoted 5 lines · Mike.lifeguard
Is it possible to have gitweb show all repositories in /path/to/wherever and also show some other repositories at particular locations like
/home/user/git/repo1and/home/user2/git/repo2? Or better yet, scan multiple dirs? Currently I can only see how to do one or the other within a single gitweb installation. I suppose I could run two of them...
P.S. It probably be a good idea to have something likemod_userdir, but gitweb currently doesn't support something like that.I had the same problematic some times ago. I wanted to have several project's roots folder for gitweb (one for each unix user of the server).
You can find the discussion here :
http://thread.gmane.org/gmane.comp.version-control.git/132926/
http://marc.info/?t=125827961600002&r=1&w=2Here the configuration I used :
/etc/gitweb.conf:$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "
/var/gitweb";
/etc/apache2/sites-available/yourvirtualhost:RewriteEngine on
RewriteRule ^/$ /cgi-bin/gitweb.cgi [QSA,L,PT]
RewriteRule ^/\~([^\/]+)/?$ /cgi-bin/gitweb.cgi
[QSA,E=GITWEB_PROJECTROOT:/home/$1/gitweb/,L,PT]I.E. :
Quoted 8 lines
Quoted 5 lines
http://yourvirtualhost/ will have
/var/gitwebas proeject root
http://yourvirtualhost/~<user>/ will have /home/<users>/gitweb as proeject rootYou can modify the rewrite rule to match what you want to do.
Would you mind writing it up and adding it as an example in gitweb/README? If you don't have time, I can try to do this myself in my free time.
Not at all. I will try to make it the more understandable possible and I will send you the patch.
Signature · 1 line
Sylvain Rabot <[email protected]>
PATCH 1/1 gitweb multiple project roots documentation
In reply to Jakub NarebskiThis commit adds in the gitweb/README file a description of how to use gitweb with several project roots using apache virtualhost rewrite rules.
--- gitweb/README | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 64 insertions(+), 3 deletions(-)
gitweb/README +64 -3
@@ -312,12 +312,16 @@ If you want to have one URL for both gitweb and your http:// repositories, you can configure apache like this: <VirtualHost *:80> - ServerName git.example.org - DocumentRoot /pub/git - SetEnv GITWEB_CONFIG /etc/gitweb.conf + ServerName git.example.org + DocumentRoot /pub/git + SetEnv GITWEB_CONFIG /etc/gitweb.conf + + # turning on mod rewrite RewriteEngine on + # make the front page an internal rewrite to the gitweb script RewriteRule ^/$ /cgi-bin/gitweb.cgi + # make access for "dumb clients" work RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT] </VirtualHost>
@@ -343,6 +347,63 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file: $home_link = "/"; +Webserver configuration with multiple projects' root +---------------------------------------------------- + +If you want to use gitweb with several project roots you can edit your apache +virtual host and gitweb.conf configuration files like this : + +virtual host configuration : + +<VirtualHost *:80> + ServerName git.example.org + DocumentRoot /pub/git + SetEnv GITWEB_CONFIG /etc/gitweb.conf + + # turning on mod rewrite + RewriteEngine on + + # make the front page an internal rewrite to the gitweb script + RewriteRule ^/$ /cgi-bin/gitweb.cgi [QSA,L,PT] + + # look for a public_git folder in unix users' home + # http://git.example.org/~<user>/ + RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] + + # http://git.example.org/+<user>/ + #RewriteRule ^/\+([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] + + # http://git.example.org/user/<user>/ + #RewriteRule ^/user/([^\/]+)/(gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] + + # defined list of project roots + RewriteRule ^/scm(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT] + RewriteRule ^/var(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/var/git/,L,PT] + + # make access for "dumb clients" work + RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT] +</VirtualHost> + +gitweb.conf configuration : + +$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/pub/git"; + +These configurations enable two things. First, each unix user (<user>) of the +server will be able to browse through gitweb git repositories found in +~/public_git/ with the following url : http://git.example.org/~<user>/ + +If you do not want this feature on your server just remove the second rewrite rule. + +If you already use mod_userdir in your virtual host or you don't want to use +the '~' as first character just comment or remove the second rewrite rule and +uncomment one of the following according to what you want. + +Second, repositories found in /pub/scm/ and /var/git/ will be accesible +through http://git.example.org/scm/ and http://git.example.org/var/. +You can add as many project roots as you want by adding rewrite rules like the +third and the fourth. + + PATH_INFO usage ----------------------- If you enable PATH_INFO usage in gitweb by putting
Signature · 1 line
1.7.0
Re: [PATCH] gitweb multiple project roots documentation
Quoted 4 lines · Sylvain Rabot
This commit adds in the gitweb/README file a description of how to use gitweb with several project roots using apache virtualhost rewrite rules.
Signed-off-by Sylvain Rabot <[email protected]>
For what it is worth:
Signature · 2 lines
Jakub Narebski Poland
PATCH 1/1 gitweb readme fixed regarding per user project root repository
In reply to Sylvain Rabotthe RewriteRule involving the '+' character is not working as it is replaced by a space in urls when you click on links.
--- gitweb/README | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
gitweb/README +6 -6
@@ -347,18 +347,18 @@ something like the following in your gitweb.conf (or gitweb_config.perl) file: $home_link = "/"; -Webserver configuration with multiple projects' root +Webserver configuration with multiple projects roots ---------------------------------------------------- -If you want to use gitweb with several project roots you can edit your apache -virtual host and gitweb.conf configuration files like this : +If you want to use gitweb with several projects roots then you can edit your +apache virtual host and gitweb.conf configuration files like this : virtual host configuration : <VirtualHost *:80> ServerName git.example.org DocumentRoot /pub/git - SetEnv GITWEB_CONFIG /etc/gitweb.conf + SetEnv GITWEB_CONFIG /etc/gitweb.conf # turning on mod rewrite RewriteEngine on
@@ -370,8 +370,8 @@ virtual host configuration : # http://git.example.org/~<user>/ RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] - # http://git.example.org/+<user>/ - #RewriteRule ^/\+([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] + # http://git.example.org/u/<user>/ + #RewriteRule ^/u/([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] # http://git.example.org/user/<user>/ #RewriteRule ^/user/([^\/]+)/(gitweb.cgi)?$ /cgi-bin/gitweb.cgi [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
Signature · 1 line
1.7.0