Force git to clone with "https://" instead of "git://" urls
If you can't clone a repository with a "git://" url because of a proxy or firewall, here is a little git configuration that will force git to use "https://" even when you'll type "git://" URL.
git config --global url."https://".insteadOf git://
With this command, it will add the following lines in you .gitconfig :
[url "https://"]
insteadOf = git://
That way, you don't have to care about using "git://" or "https://" when you are cloning repo, both urls will work.
Maybe a well known tweak but discovered it lately...
Related protips:
Written by Johan BLEUZEN
Related protips
3 Responses
You can also limit this URL rewriting to an explicit list of Git repos that are outside your firewall. This way you can still use the git://
scheme inside your LAN with your internal repos.
git config --global url."https://github.com".insteadOf git://github.com
@steve-jansen:
You can also use "url.instedOf" to create shortcuts:
git config --global url."https://github.com/".insteadOf github:
I can then do;
git clone github:dolmen/github-keygen.git
Thanks for this tip, for some reason I can't get https connections to work behind my company's proxy, so i used the opposite of this to force git:// connections. Thanks!