torvalds at linux-foundation.org
Thu Nov 16 15:36:08 EST 2017
On Tue, Nov 14, 2017 at 1:46 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
> And then people can do this:
> [url "ssh://email@example.com"]
> insteadOf = https://git.kernel.org
> insteadOf = http://git.kernel.org
> insteadOf = git://git.kernel.org
> which makes git.kernel.org addresses use ssh, and avoid the whole
> possible DNS spoofing problem.
So credit goes for Konstantin for pointing that out, and I actually
used it this merge window.
A few notes for other people who end up doing this:
(a) ssh is slower, and the gitolite machine is not as reachable.
(b) it affects your merge commit message.
As to (a), yes it's noticeable, but the extra couple of seconds isn't
really that big of a deal. Depending on exactly where you are, though,
you might end up wanting to use https:// to the public servers
But (b) actually ends up being annoying, because I don't like my merge
commits to contain references to repositories that aren't actually
available unless you have a kernel.org account.
I tried to edit things up by hand, but honestly, that just meant that
I forgot about 50% of the time. Do a
git log --author=Torvalds --grep=ssh://gitolite
to see my shameful lack of actually fixing up the end result.
Happily, once you realize that you have the attention span of a
slightly retarded chipmunk, and that you keep on forgetting to fix
things up, you hopefully also go "I'm a moron, but I can compensate
for that automatically".
Which is simple. Just create a .git/hooks/prepare-commit-msg file that contains
sed -i 's|ssh://gitolite.kernel.org/|git://git.kernel.org/|g' "$1"
and make it executable, and git will do that commit message editing for you.
Tadaa! Now you don't look like quite the tool that I did.
More information about the Kernelnewbies