Re: [PATCH v2] ssh: add 'ssh.keyfile' option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 23, 2020, 19:32 UTC
- Message-ID
- <xmqqimhqgfrd.fsf@gitster.c.googlers.com>
- In-Reply-To
- <d26f8556-ed9b-5145-735b-d348449bb31d@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 19 quoted lines
> Am 23.04.20 um 13:21 schrieb Raymond E. Pasco: >> When a specific private key needs to be used with a repository, manually >> specifying it via 'core.sshCommand' is not ideal. This option allows a >> keyfile to be specified in the local configuration. If a keyfile is >> specified, SSH agents are disabled for the command. > > You can do this without modifying Git. Say, your key file is > ~/.ssh/id_other_ed25519, then do this: > > Rename your remote to use an invented host name: > > git remote set-url origin git@other.github.com:other/repo > > Then attach the invented name to the real host name and the identity in > your ~/.ssh/config: > > Host other.github.com > Hostname github.com > Identity ~/.ssh/id_other_ed25519
Nice. I wonder if this answer (and answers to other "how would I use .ssh/config to adjust Git to suite my use?" questions people may often ask) can be put in some of our documentation.