git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [Question] Switching the URI from SSH to HTTPS for submodules

From
rsbecker@nexbridge.com <rsbecker@nexbridge.com>
Date
Dec 7, 2021, 14:50 UTC
Message-ID
<00b901d7eb79$c374f070$4a5ed150$@nexbridge.com>
In-Reply-To
<CAFLLRp+yakYKxeGHjvg-8s-5QP8GqMeA5t+azfny=v6wtPPW2A@mail.gmail.com>
On December 6, 2021 6:54 PM, Robert Coup wrote:
Show 36 quoted lines
> 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
Previous: Robert CoupNext: Fabian Stelzer
Message 3 of 5 in “[Question] Switching the URI from SSH to HTTPS for submodules”
  1. rsbecker@nexbridge.comDec 6, 2021
  2. Robert CoupDec 6, 2021
  3. rsbecker@nexbridge.comDec 7, 2021
  4. Fabian StelzerDec 8, 2021
  5. rsbecker@nexbridge.comDec 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.