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

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

 



Hi Randall,

On Mon, 6 Dec 2021 at 23:10, <rsbecker@xxxxxxxxxxxxx> wrote:
>
> git@xxxxxxxxxxxxx: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@xxxxxxxxxxxxx/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@xxxxxxxxxxxxx/".insteadOf
"git@xxxxxxxxxxxxx:"

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@xxxxxxxxxxxxx/".insteadOf="git@xxxxxxxxxxxxx:";
clone --recurse-submodules git@xxxxxxxxxxxxx: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@xxxxxxxxxxxxx/".insteadOf
"git@xxxxxxxxxxxxx:"
    $ git submodule foreach --recursive 'git config
url."https://user@xxxxxxxxxxxxx/".insteadOf "git@xxxxxxxxxxxxx:" '

Maybe there's an opportunity to make that part easier?

Rob :)



[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