From: Wesley Schwengle <wesleys@opperschaap.net>
To: git@vger.kernel.org
Subject: [PATCH 0/3] Add support for per-remote and per-namespace SSH options
Date: Thu, 26 Mar 2026 19:37:35 -0400 [thread overview]
Message-ID: <20260326233739.2911354-1-wesleys@opperschaap.net> (raw)
With this changeset applied git is now aware of `sshIdentityFiles' and
`sshOpts'. This allows users to have multiple accounts on the same forges.
A common problem within the developer community. This problem is often
solved by hacking in one's `.ssh/config' and changing hostname URIs to
ensure the correct key is being used.
For years I had zsh wrapper script that was used as the `core.sshCommand' and
is a reference implementation of this change.
In order of importance:
Configuration on the remotes itself. This is easy, straight forward and
should allow people to get it to work quickly:
* `remote.*.sshIdentityFile' and `remote.*.sshOpts'
Configuration set on owner/path style. This is to support `includeIf`
configuration management. For example, a git-forge that host both
employer/client repo's. Eg, `git@gitlab.com/waterkip/git.git' and
`git@gitlab.com/corp/git.git' would have something configured as:
* `core.sshIdentityFile.*', eg
[core "sshIdentityFile"]
waterkip = ~/.ssh/id_ed25519_me
corp = ~/.ssh/id_ed25519_corporate
And finally, a global override for everything:
* `core.sshIdentityFile' and `core.sshOpts'
I stayed within the `core' namespace, mainly because `core.sshCommand'. I'm
happy to move it to `ssh' or something similar. It would perhaps make
`ssh.*.sshIdentifyFile' more structured, because now that's split between two
core subsections.
The following assumptions have been made to make it safe and sound for
users. When an `sshIdentityFile' is used and no `sshOpts' are configured git
will inject `-F /dev/null' to prevent cycling over all sshIdentityFiles
a user has in their `.ssh/config'. When a user configures `sshOpts', these
take precedence and a user itself is responsible for setting
`-F /dev/null'.
Separate push/pull URIs are not supported by the feature. The biggest problem
with this is that I don't know how to properly configure them with the
namespace constraints. `remote.*.xyz' is as deep as git can go and a push/pull
would require additional configuration. I filed it under edge-case.
There are two new structs introduced: `ssh_options' and `cnx_context'.
They are there to limit the amount of argument passing down the wire. And this
is especially true for `ssh_options' because it keeps `push_ssh_options' dumb.
Wesley Schwengle (3):
connect: Rename name to command in connect_git()
connect: Add transport->remote->name to git_connect()
connect: Add support for per-remote and per-namespace SSH options
Documentation/config/core.adoc | 22 ++++
Documentation/config/remote.adoc | 9 ++
builtin/fetch-pack.c | 2 +-
builtin/send-pack.c | 2 +-
connect.c | 144 ++++++++++++++++++++--
connect.h | 2 +-
t/t57xx-ssh-options-config.sh | 198 +++++++++++++++++++++++++++++++
transport.c | 9 +-
8 files changed, 375 insertions(+), 13 deletions(-)
create mode 100755 t/t57xx-ssh-options-config.sh
--
2.53.0.722.g8e572876c5
next reply other threads:[~2026-03-26 23:38 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 23:37 Wesley Schwengle [this message]
2026-03-26 23:37 ` [PATCH 1/3] connect: Rename name to command in connect_git() Wesley Schwengle
2026-03-27 21:33 ` Jeff King
2026-03-28 0:58 ` Wesley
2026-03-28 1:44 ` Jeff King
2026-03-28 2:01 ` Wesley
2026-03-26 23:37 ` [PATCH 2/3] connect: Add transport->remote->name to git_connect() Wesley Schwengle
2026-03-27 21:39 ` Jeff King
2026-03-26 23:37 ` [PATCH 3/3] connect: Add support for per-remote and per-namespace SSH options Wesley Schwengle
2026-03-27 21:45 ` Jeff King
2026-03-28 0:43 ` Wesley
2026-03-28 2:03 ` Jeff King
2026-03-28 2:25 ` Wesley
2026-03-27 7:51 ` [PATCH 0/3] " Johannes Sixt
2026-03-27 15:04 ` Wesley
2026-03-27 16:10 ` Junio C Hamano
2026-03-27 16:49 ` Wesley
2026-03-27 22:06 ` brian m. carlson
2026-03-28 1:02 ` Wesley
2026-03-28 7:46 ` Johannes Sixt
2026-03-28 14:59 ` Wesley
2026-03-29 14:33 ` Ben Knoble
2026-03-27 21:51 ` brian m. carlson
2026-03-27 22:25 ` Junio C Hamano
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=20260326233739.2911354-1-wesleys@opperschaap.net \
--to=wesleys@opperschaap.net \
--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).