git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: "Benedek Rácz" <betontalpfa@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [Improvement] Separate protocol and path in gitmodules
Date: Fri, 8 Nov 2019 01:45:18 +0000	[thread overview]
Message-ID: <20191108014518.GH32531@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CAAMvNNQyzMwAhizT-vBpbwfzAAHS6Ycx2tCLZ_eND3SK8WdTGg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

On 2019-11-07 at 13:52:28, Benedek Rácz wrote:
> Hi All,
> 
> **The issue**
> My problem is based on this post: https://stackoverflow.com/q/40841882/2506522
> 
> **Use-case:**
> Git can be used with SSH or with HTTP. The usage of SSH is easier, due
> to automatic authentication (ssh-key). But I have to use git from a
> public PC, where I mustn't store my ssh-keys. On that PC I want to use
> https's user/password authentication.

You can use the url.<base>.insteadOf feature to rewrite URLs, which will
do what you want in this case.

For example, I could set
url.https://git.crustytoothpaste.net/git/.insteadOf to
"ssh://bmc@git.crustytoothpaste.net/srv/scm/git/".  That would rewrite
the SSH URLs for my Git server to an appropriate HTTPS URL.

It's designed for situations like this, when you know the rewriting
rules better than an external system.

> **Suggestion**
> The root-cause of this issue is that the protocol (SSH or HTTP) and
> the path of the remote repository is stored together (in the
> .gitmodules file). If they were stored separately I would choose the
> protocol easily.

The problem is that we don't know that a repository is accessible by
both of those methods, or even if it is, what the correspondence between
them is.

For example, my personal repositories are under
https://git.crustytoothpaste.net/git/bmc/ and
ssh://bmc@git.crustytoothpaste.net/srv/scm/git/bmc/.  Those paths are
completely different.  There's no way to intrinsically map from one to
the other without external knowledge.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

      reply	other threads:[~2019-11-08  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 13:52 [Improvement] Separate protocol and path in gitmodules Benedek Rácz
2019-11-08  1:45 ` brian m. carlson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108014518.GH32531@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=betontalpfa@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).