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

Re: [PATCH v2] ssh: add 'ssh.keyfile' option

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 23, 2020, 17:24 UTC
Message-ID
<d26f8556-ed9b-5145-735b-d348449bb31d@kdbg.org>
In-Reply-To
<20200423112110.45405-1-ray@ameretat.dev>
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
-- Hannes
Previous: Raymond E. PascoNext: Junio C Hamano
Message 3 of 9 in “ssh: add 'ssh.keyfile' option”
  1. ssh: add 'ssh.keyfile' optionRaymond E. Pasco, Apr 23, 2020
  2. ssh: add 'ssh.keyfile' optionRaymond E. Pasco, Apr 23, 2020
  3. Johannes SixtApr 23, 2020
  4. Junio C HamanoApr 23, 2020
  5. Raymond E. PascoApr 24, 2020
  6. Matthias AßhauerApr 23, 2020
  7. Junio C HamanoApr 23, 2020
  8. Matthias AßhauerApr 24, 2020
  9. connect.c: clarify BUG() messages in push_ssh_optionsMatthias Aßhauer, Apr 25, 2020

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.