Git fetch/push over HTTP(S)

1,881 views
Skip to first unread message

Boris Brodski

unread,
Jun 27, 2011, 9:20:25 AM6/27/11
to Repo and Gerrit Discussion
Hello,


I wounder, is it possible to configure Gerrit to supprt git fetch/push
through HTTP or HTTPS. (This is supported by GitHub, for example.)

This is unfortunately the crucial requirement - access git repository
through HTTP proxy.


In case this feature not supported directly by Gerrit, is it possible
to configure some
kind of git-proxy or mirror to overcome this problem.


Thank you for the great product!


Regards,
Boris Brodski

Shawn Pearce

unread,
Jun 27, 2011, 10:00:54 AM6/27/11
to Boris Brodski, Repo and Gerrit Discussion
On Mon, Jun 27, 2011 at 06:20, Boris Brodski <Brodsk...@yahoo.com> wrote:
> I wounder, is it possible to configure Gerrit to supprt git fetch/push
> through HTTP or HTTPS. (This is supported by GitHub, for example.)

It is supported. Configure the Gerrit web UI (e.g. behind Apache
reverse proxy, or with SSL, etc.) Individual users need to go to
Settings > HTTP Password and Generate their personal password for HTTP
Git access.

Repository URLs are: $GERRIT_URL/p/$REPOSITORY

E.g. the "tools/gerrit" project/repository of review.example.com can
be accessed as:

http://review.example.com/p/tools/gerrit

This feature *requires* Git 1.6.6 or newer on the client side. I don't
know if GitHub supports older versions of Git-over-HTTP, but I do know
Gerrit Code Review only supports the newer Git-over-HTTP, and thus
needs the newer clients.

Boris Brodski

unread,
Jun 27, 2011, 11:59:21 AM6/27/11
to Repo and Gerrit Discussion
Thank you very much for the quick feedback!

This helped me a lot!

It works indeed :-)



On 27 Jun., 16:00, Shawn Pearce <s...@google.com> wrote:

Steffen Gebert

unread,
Jul 6, 2011, 5:33:48 AM7/6/11
to Repo and Gerrit Discussion
Hi,

> Repository URLs are: $GERRIT_URL/p/$REPOSITORY
>
> E.g. the "tools/gerrit" project/repository of review.example.com can
> be accessed as:
>
> http://review.example.com/p/tools/gerrit

as we're currently in a conference center, which blocks the Gerrit port, we're pretty much relying on this way for a few days.

However, we have a problem with submodules - they all reference to the git:// urls.
Is there a better way to override this locally - or could the submodules be reference relative to the URL? We gave it a try and modified .gitmodules to the new URLs, which worked out well. Maybe is there some equivalent to pushInsteadOf (to globally replace URLs)?

Thanks
Steffen
--
Steffen Gebert
TYPO3 v4 Core Team Member

TYPO3 .... inspiring people to share!
Get involved: http://typo3.org

Shawn Pearce

unread,
Jul 6, 2011, 10:14:09 AM7/6/11
to Steffen Gebert, Repo and Gerrit Discussion
On Wed, Jul 6, 2011 at 02:33, Steffen Gebert <ste...@steffen-gebert.de> wrote:
>> Repository URLs are:  $GERRIT_URL/p/$REPOSITORY
>>
>> E.g. the "tools/gerrit" project/repository of review.example.com can
>> be accessed as:
>>
>>  http://review.example.com/p/tools/gerrit
>
> as we're currently in a conference center, which blocks the Gerrit port, we're pretty much relying on this way for a few days.
>
> However, we have a problem with submodules - they all reference to the git:// urls.
> Is there a better way to override this locally - or could the submodules be reference relative to the URL? We gave it a try and modified .gitmodules to the new URLs, which worked out well. Maybe is there some equivalent to pushInsteadOf (to globally replace URLs)?

Put something like this in your ~/.gitconfig ?

[url "http://review.example.com/p/"]
insteadOf = git://review.example.com/

[url "http://review.example.com/p/"]
insteadOf = ssh://review.example.com:29418/

Kordan Ou

unread,
Jul 27, 2011, 5:23:21 AM7/27/11
to Repo and Gerrit Discussion, 曜瑋歐
Excuse me, I followed your instruction but no luck...:(

URL of gerrit: https://example.com/gerrit
The repository: proj/foo

(ssh protocal works fine: git clone ssh://US...@example.com:29418/proj/foo.git)

1. git clone https://US...@example.com/gerrit/p/proj/foo
2. prompt for password: paste the password generated from "HTTP
password" of https://example.com/gerrit
3. Got the error message:

Cloning into foo...
Password:
fatal: Authentication failed

In /var/log/lighttpd/error_log :
011-07-27 16:59:42: (http_auth.c.880) password doesn't match for /
gerrit/p/proj/foo/info/refs USER , IP: 123.123.123.123

I've also tried these possible passwords in :
1. /var/www/localhost/gitweb/.htaccess
2. password for ssh

But still failed.

Did I do something wrong or miss certain configuration?
Any idea will be much appreciate, thanks a lot!

On 6月27日, 下午10時00分, Shawn Pearce <s...@google.com> wrote:
> On Mon, Jun 27, 2011 at 06:20, Boris Brodski <Brodsky_Bo...@yahoo.com> wrote:
> > I wounder, is it possible to configure Gerrit to supprt git fetch/push
> > throughHTTPor HTTPS. (This is supported by GitHub, for example.)
>
> It is supported. Configure the Gerrit web UI (e.g. behind Apache
> reverse proxy, or with SSL, etc.) Individual users need to go to
> Settings >HTTPPassword and Generate their personal password forHTTP

Shawn Pearce

unread,
Jul 27, 2011, 11:59:10 AM7/27/11
to Kordan Ou, Repo and Gerrit Discussion

Hmm it seems your proxy server (lighttpd) is evaluating the user login before it can get to the Gerrit server. This won't work since the lighttpd server does not have the password to validate the request against.

Check your lighttpd server configuration and make sure it is passing through the /p/ directory without doing its own authentication check.

Reply all
Reply to author
Forward
0 new messages