Tricking git into SSH

Even when the URL tells it otherwise!

Posted by Hendrik 'T4cC0re' Meyer on November 04, 2019 · ˜1 min read

Today I was wandering the world of HTTP/3 and cURL. As it turns out, you need to compile it yourself in order to get experimental HTTP/3 support.

But when doing a recursive clone on Cloudflare’s quiche library I was greeted with horribly slow clones. I saw quickly what the issue was. An https:// clone in a submodule. Luckily git provides a way to rewrite URLs, without touching anything in the repo! Perfect for these kind of hacks.

In order to make use of it just add a blob like this into your .gitconfig

[url "ssh://git@<remotehost>/"]
	insteadOf = https://<remotehost>/

So in my case it looks somewhat like this:

[url "ssh://[email protected]/"]
	insteadOf =

[url "ssh://[email protected]/"]
	insteadOf =

You can also just apply this override to pushes, simply set pushInsteadOf instead of insteadOf. Or hell. Push to a different URL when you pull from another override, go nuts!