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

How should submodules use different sshCommand during initial update?

From
SXShibo Xia <sbxia25@gmail.com>
Date
Apr 13, 2026, 15:45 UTC
Message-ID
<CAAC4ekqE0rGTeZA3fPKYePr3=J8pHe-KORgn5W026J8AAhRRHw@mail.gmail.com>
Hi,

I have a question about submodules and SSH authentication during the initial git submodule update --init step.

I understand that there are already a few ways to influence SSH behavior:
core.sshCommand at the repository level
GIT_SSH_COMMAND at the command level
SSH host aliases and other settings in ~/.ssh/config
However, I am running into a more specific problem with submodules.

My use case is that different submodules may need different SSH identities or different SSH command settings. For an already initialized submodule, this can be handled by entering the submodule repository and configuring it separately. But during the initial git submodule update --init, the submodule does not yet have its own local config, so there does not seem to be a clean per-submodule way to do this from Git itself.

In practice, the usual workaround seems to be putting the logic into SSH configuration and encoding it through host aliases or URL layout. That works, but it also means the authentication behavior is kept outside Git's submodule configuration, even though the submodule remote itself is already configured in Git.

So my questions are:

Is there already a recommended Git-native way to handle different sshCommand values for different submodules during initial clone/update?

If not, would support for something like a per-submodule sshCommand configuration be considered reasonable?

Has this been discussed before specifically in the context of submodule initialization, rather than per-remote SSH options in general?

I am not sending a patch yet. I first wanted to ask whether this is considered a real gap in current submodule behavior, or whether the expectation is that SSH configuration should remain the only solution here.

Best regards, Shibo Xia

Next: Junio C Hamano
Message 1 of 5 in “How should submodules use different sshCommand during initial update?”
  1. Shibo XiaApr 13, 2026
  2. Junio C HamanoApr 13, 2026
  3. Shibo XiaApr 14, 2026
  4. Jeff KingApr 14, 2026
  5. Shibo XiaApr 14, 2026

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.