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

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

From
rsbecker@nexbridge.com <rsbecker@nexbridge.com>
Date
Dec 6, 2021, 23:10 UTC
Message-ID
<001501d7eaf6$79d8e170$6d8aa450$@nexbridge.com>
This is a follow-up to the conversation at #git-devel Standup today.

We encountered the following situation. Our normal clone practice is to use SSH URIs. So, the clone is straightforward with the main (8 year old) repo of the style:

git@bitbucket.org:project/repo.git
with submodules referenced as:
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

which caused the submodule clone not to work. Fortunately, the number of submodules was low, so a manual edit of .gitmodules (with update-index --assume-unchanged) and .git/modules and .git/config was not onerous. However, we should be able to redirect the configuration without having to do that. Our directory references are all relative to the main repo, so those did not have to change. We still use SSH for most work with the repo but needed to get source onto a test system for debugging.

I would like to put together a best practice section in Documentation/gitsubmodules.txt on the subject, but really don't think I did this *temporary* change the most effective way. I'm looking for better practices than I used - I'm sure there is at least one. There may be code changes involved, particularly since .gitmodules is tracked and contains the full URI (maybe it should not). One option we also explored was explicitly specifying the URI for each submodule using set-url, which works but it seems like there should be something in clone that redirects the part of the URI relative to the main repo - although that would only work in the special case where the submodules have the same host and project as the main repo.

-Randall
Next: Robert Coup
Message 1 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.