Re: [Improvement] Separate protocol and path in gitmodules

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

 



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@xxxxxxxxxxxxxxxxxxxxxxxx/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@xxxxxxxxxxxxxxxxxxxxxxxx/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: signature.asc
Description: PGP signature


[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]

  Powered by Linux