gerrit clone over http

3,822 views
Skip to first unread message

Dmitry Loginov

unread,
Aug 24, 2011, 7:10:17 AM8/24/11
to Repo and Gerrit Discussion
Hello,

I installed version 2.2.1 GERRIT to the server. I created a test
project. Through the web interface (http://git.yotalab.ru:8081/gerrit)
I allow anonymous read access for this project. Next I ran the command
"git clone" using SSH address project ssh://dlog...@git.yotalab.ru:29418/test_gerrit

But I could not do the same through an HTTP-address "git clone
http://git.yotalab.ru:8081/test_gerrit" (output: not found /info/refs)

Why? What i do wrong?

WBR, Dmitry Loginov


Here is my configuration:
* gerrit installation folder - /srv/gerrit
* git projects directory - /srv/git
* gerrit.config
===========
[gerrit]
basePath = /srv/git
[database]
type = H2
database = db/ReviewDB
[auth]
type = LDAP
[ldap]
server = ldap://ldap.domain.ru/
username =
CN=AD_Checker,OU=Services,OU=YotaLab,OU=SPB,DC=ru,DC=yotateam,DC=com
accountBase = OU=YotaLab,OU=SPB,DC=ru,DC=yotateam,DC=com
groupBase = ou=YotaLab
Groups,OU=YotaLab,OU=SPB,DC=ru,DC=yotateam,DC=com
[sendemail]
smtpServer = mx.domain.ru
[container]
user = git_superuser
javaHome = /usr/java/default/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = proxy-http://*:8081/gerrit
requestLog = true
[cache]
directory = cache
[download]
scheme = ssh
scheme = http
scheme = anon_http
scheme = anon_git
scheme = repo_download
[mimetype "image/*"]
safe = true
[mimetype "application/pdf"]
safe = true
[mimetype "application/pdm"]
safe = true
[mimetype "application/msword"]
safe = true
[pack]
deltacompression = true
threads = 2
[receive]
allowGroup = Administrators
[upload]
allowGroup = Administrators
[repository "*"]
createGroup = Administrators
createGroup = Registred Users
ownerGroup = Registred Users
[gitweb]
cgi = /var/www/git/gitweb.cgi
url = http://git.yotalab.ru/
=====

* httpd.conf
=============
<VirtualHost *>
ServerName git.yotalab.ru
ServerAlias git.tst.yotalab.ru
DocumentRoot /var/www/git
SetEnv GITWEB_CONFIG /etc/gitweb.conf

## GERRIT BEGIN
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

# Reverse-proxy these requests to the Gerrit Jetty server
RedirectMatch ^/gerrit$ /gerrit/
ProxyPass /gerrit/ http://127.0.0.1:8081/gerrit/

## GERRIT END

ScriptAlias /cgi-bin/ "/var/www/git/"
# ScriptAlias /git/ "/var/www/githttp/"

SetEnv GIT_PROJECT_ROOT /srv/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
# ScriptAliasMatch \
# "(?x)^/(.*/(HEAD | \
# info/refs | \
# objects/(info/[^/]+ | \
# [0-9a-f]{2}/[0-9a-f]{38} | \
# pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
# git-(upload|receive)-pack))$" \
# "/var/www/githttp/git-http-backend/$1"

#<Directory /var/www/githttp>
# AllowOverride None
# Options +ExecCGI
# Require valid-user
#</Directory>

<LocationMatch "^/git/">
#<Directory /var/www/githttp>
# AllowOverride None
# Options +ExecCGI
# AuthType Basic
# AuthBasicProvider ldap
# AuthzLDAPAuthoritative off
# AuthName "YOTARU Domain Credentials Required for GIT"
# Require valid-user
#</Directory>

</LocationMatch>

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


# 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>

=============


Shawn Pearce

unread,
Aug 24, 2011, 10:19:09 AM8/24/11
to Dmitry Loginov, Repo and Gerrit Discussion
On Wed, Aug 24, 2011 at 04:10, Dmitry Loginov <qre...@gmail.com> wrote:
> I installed version 2.2.1 GERRIT to the server. I created a test
> project. Through the web interface (http://git.yotalab.ru:8081/gerrit)
> I allow anonymous read access for this project. Next I ran the command
> "git clone" using SSH address project ssh://dlog...@git.yotalab.ru:29418/test_gerrit
>
> But I could not do the same through an HTTP-address "git clone
> http://git.yotalab.ru:8081/test_gerrit" (output: not found /info/refs)

Add a /p/ directory in front of the project. That is, you can clone
over HTTP from a Gerrit server by the URL:

http://server:8081/p/test_gerrit

The general form of the URLs is:

http://server:8081/p/PROJECT_NAME
ssh://server:29418/PROJECT_NAME

> Here is my configuration:


> * httpd.conf
> =============
> <VirtualHost *>
>    ServerName                  git.yotalab.ru
>    ServerAlias                 git.tst.yotalab.ru
>    DocumentRoot                /var/www/git
>    SetEnv                              GITWEB_CONFIG   /etc/gitweb.conf
>
> ## GERRIT BEGIN
>    ProxyRequests Off
>    ProxyVia Off
>    ProxyPreserveHost On
>    <Proxy *>
>      Order deny,allow
>      Allow from all
>    </Proxy>
>
>    # Reverse-proxy these requests to the Gerrit Jetty server
>    RedirectMatch ^/gerrit$     /gerrit/
>    ProxyPass      /gerrit/     http://127.0.0.1:8081/gerrit/

Hmm, well, I guess this means your URL is
http://server/gerrit/p/PROJECT_NAME :-)

>    SetEnv GIT_PROJECT_ROOT /srv/git
>    SetEnv GIT_HTTP_EXPORT_ALL
>    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
> #    ScriptAliasMatch \
> #        "(?x)^/(.*/(HEAD | \
> #               info/refs | \
> #               objects/(info/[^/]+ | \
> #                        [0-9a-f]{2}/[0-9a-f]{38} | \
> #                        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
> #               git-(upload|receive)-pack))$" \
> #               "/var/www/githttp/git-http-backend/$1"

This obviously should not be necessary if you use the Gerrit server's /p/ URL.

Dmitry Loginov

unread,
Aug 24, 2011, 11:04:28 AM8/24/11
to Repo and Gerrit Discussion


On 24 авг, 18:19, Shawn Pearce <s...@google.com> wrote:
> On Wed, Aug 24, 2011 at 04:10, Dmitry Loginov <qrea...@gmail.com> wrote:
> > I installed version 2.2.1 GERRIT to the server. I created a test
> > project. Through the web interface (http://git.yotalab.ru:8081/gerrit)
> > I allow anonymous read access for this project. Next I ran the command
> > "git clone" using SSH address project ssh://dlogi...@git.yotalab.ru:29418/test_gerrit
>
> > But I could not do the same through an HTTP-address "git clone
> >http://git.yotalab.ru:8081/test_gerrit" (output: not found /info/refs)
>
> Add a /p/ directory in front of the project. That is, you can clone
> over HTTP from a Gerrit server by the URL:
>
>  http://server:8081/p/test_gerrit
thanks. it is work!
But i use http://server:8081/gerrit/p/test_gerrit

>
> The general form of the URLs is:
>
>  http://server:8081/p/PROJECT_NAME
>   ssh://server:29418/PROJECT_NAME
ive got it

>
>
> > Here is my configuration:
> > * httpd.conf
> > =============
> > <VirtualHost *>
> >    ServerName                  git.yotalab.ru
> >    ServerAlias                 git.tst.yotalab.ru
> >    DocumentRoot                /var/www/git
> >    SetEnv                              GITWEB_CONFIG   /etc/gitweb.conf
>
> > ## GERRIT BEGIN
> >    ProxyRequests Off
> >    ProxyVia Off
> >    ProxyPreserveHost On
> >    <Proxy *>
> >      Order deny,allow
> >      Allow from all
> >    </Proxy>
>
> >    # Reverse-proxy these requests to the Gerrit Jetty server
> >    RedirectMatch ^/gerrit$     /gerrit/
> >    ProxyPass      /gerrit/    http://127.0.0.1:8081/gerrit/
>
> Hmm, well, I guess this means your URL is http://server/gerrit/p/PROJECT_NAME:-)
No. Because my gerrit.config have this:
[httpd]
listenUrl = proxy-http://*:8081/gerrit
requestLog = true


>
> >    SetEnv GIT_PROJECT_ROOT /srv/git
> >    SetEnv GIT_HTTP_EXPORT_ALL
> >    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
> > #    ScriptAliasMatch \
> > #        "(?x)^/(.*/(HEAD | \
> > #               info/refs | \
> > #               objects/(info/[^/]+ | \
> > #                        [0-9a-f]{2}/[0-9a-f]{38} | \
> > #                        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
> > #               git-(upload|receive)-pack))$" \
> > #               "/var/www/githttp/git-http-backend/$1"
>
> This obviously should not be necessary if you use the Gerrit server's /p/ URL.

So it helped. But I encountered another problem: cannot auth by http-
ldap. But i think i can fix it by gerrit.config

PS: thanks a lot and sorry for my english
Reply all
Reply to author
Forward
0 new messages