git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Shibo Xia <sbxia25@gmail.com>
To: git@vger.kernel.org
Subject: How should submodules use different sshCommand during initial update?
Date: Mon, 13 Apr 2026 23:45:53 +0800	[thread overview]
Message-ID: <CAAC4ekqE0rGTeZA3fPKYePr3=J8pHe-KORgn5W026J8AAhRRHw@mail.gmail.com> (raw)

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


             reply	other threads:[~2026-04-13 15:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 15:45 Shibo Xia [this message]
2026-04-13 16:02 ` How should submodules use different sshCommand during initial update? Junio C Hamano
2026-04-14  1:28   ` Shibo Xia
2026-04-14  6:15     ` Jeff King
2026-04-14  7:25       ` Shibo Xia

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAC4ekqE0rGTeZA3fPKYePr3=J8pHe-KORgn5W026J8AAhRRHw@mail.gmail.com' \
    --to=sbxia25@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).