Re: .gitmodules containing SSH clone URLs should fall back to HTTPS when SSH key is not valid/existent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 29, 2014 at 04:12:38PM -0700, Jonathan Leonard wrote:

> We are using GitHub.
> [...]
> > But why is https special? Why not fall back to the git
> > protocol? Or http? (And no: I'm not serious here ;-)
> >
> 
> HTTPS isn't special except in that it is the least privileged
> transport type (and thus should be the last resort). Whether to
> fallback to git:// from ssh:// or vice versa is inconsequential to
> this request.

That's not quite true. git:// is the least privileged transport, as it
always anonymous and read-only (there ways to allow insecure pushes over
it, but GitHub does not enable them). Https is actually the most
flexible protocol, in that the same URL works of the box for both
logged-in and anonymous users (the latter assuming the repo is publicly
available). The server only prompts for credentials if necessary.

For that reason, it's a good choice for things like submodule URLs baked
into .gitmodules files.

The reasons not to are:

  1. It isn't _quite_ as efficient or robust as the regular git
     protocol, though in practice it's generally not a big deal.

  2. Pushers may prefer to authenticate with ssh keys (e.g., because
     they run ssh agent). I hope with modern credential helpers that
     logging in via http should not be a pain, either, though.

> > After the first failed clone of the submodule at via SSH the
> > developer could also just do a
> >
> >    git config submodule.<name>.url https://host/repo
> >
> > and override the URL from .gitmodules.
>
> Yes, this would work. But it would be a painful manual step which we
> would not want to force on ordinary users (and would not want to
> experience ourselves either).

Using insteadOf of in your global ~/.gitconfig would make this a
one-liner per-user. So one option would be to reverse things. Put
"https" URLs into the .gitmodules file, so most people have to do
nothing, and then developers who really want to do git-over-ssh can do a
one-time:

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

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]