git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <rsbecker@nexbridge.com>
To: "'Robert Coup'" <robert.coup@koordinates.com>
Cc: <git@vger.kernel.org>, <avarab@gmail.com>
Subject: RE: [Question] Switching the URI from SSH to HTTPS for submodules
Date: Tue, 7 Dec 2021 09:50:17 -0500	[thread overview]
Message-ID: <00b901d7eb79$c374f070$4a5ed150$@nexbridge.com> (raw)
In-Reply-To: <CAFLLRp+yakYKxeGHjvg-8s-5QP8GqMeA5t+azfny=v6wtPPW2A@mail.gmail.com>

On December 6, 2021 6:54 PM, Robert Coup wrote:
> On Mon, 6 Dec 2021 at 23:10, <rsbecker@nexbridge.com> wrote:
> >
> > git@bitbucket.org:project/module.git
> >
> > When in SSH mode, clones are simple with --recurse-submodules doing
> > what we want. However, we had to clone on a system where SSH was
> > locked down and we could only use HTTPS. The form of the URIs changed
> rather radically:
> >
> > https://user@bitbucket.org/project/repo.git
> >
> > I'm looking for better practices than I used - I'm sure there is at least one.
> 
> AFAIK the existing `url.<base>.insteadOf` config option[1] deals with this...
> 
> [1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-
> urlltbasegtinsteadOf
> 
>     $ git config --global url."https://user@bitbucket.org/".insteadOf
> "git@bitbucket.org:"
> 
> If you don't want to set it globally (not a throwaway CI environment?) then
> you can do it as a one-off:
> 
>     $ git -c url."https://user@bitbucket.org/".insteadOf="git@bitbucket.org:"
> clone --recurse-submodules git@bitbucket.org:repo/project.git
> 
> But it isn't persisted into your repo config then, so subsequent fetches won't
> work. You'd need to persist it using something like:
> 
>     $ git config url."https://user@bitbucket.org/".insteadOf
> "git@bitbucket.org:"
>     $ git submodule foreach --recursive 'git config
> url."https://user@bitbucket.org/".insteadOf "git@bitbucket.org:" '
> 
> Maybe there's an opportunity to make that part easier?

Well, I gave this a shot. The mapping did not appear to work - I tried a few combinations. I was left with the original URIs. Note that I also had to do 

$ git submodule init

which reported the wrong URIs

$ git submodule update

which obviously failed since they were still using SSH.

I think there may be something not working correctly with the insteadOf operator. This is easily reproduceable. 

-Randall


  reply	other threads:[~2021-12-07 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 23:10 [Question] Switching the URI from SSH to HTTPS for submodules rsbecker
2021-12-06 23:53 ` Robert Coup
2021-12-07 14:50   ` rsbecker [this message]
2021-12-08 12:51     ` Fabian Stelzer
2021-12-08 13:44       ` rsbecker

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='00b901d7eb79$c374f070$4a5ed150$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=robert.coup@koordinates.com \
    /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).