How to convert `git:` urls to `http:` urls

noamtm picture noamtm · Nov 12, 2009 · Viewed 96.2k times · Source

I'm working behind an http proxy. I'm trying to clone Android's source tree using their "repo" tool.

This tool insists on using git:// URLs, even though http:// URLs also work. As a result, I can't download the source.

Is it possible to force git to always use http?

Edit: my http_proxy is configured correctly. For example, this works:

git clone http://android.git.kernel.org/platform/manifest.git

But this doesn't (errno=Connection timed out):

git clone git://android.git.kernel.org/platform/manifest.git

So this answer does not really help me.

Answer

Tobu picture Tobu · Jul 8, 2012

Here's an example of rewriting the default protocol for GitHub:

git config --global url.https://github.com/.insteadOf git://github.com/

Git documentation for url.<base>.insteadOf:

git config [--global] url.<base>.insteadOf <other_url>

Any URL that starts with this value will be rewritten to start, instead, with <base>. When more than one insteadOf strings match a given URL, the longest match is used.