How to use ssh -i with a key from ssh-agent rather than from a file?

Damien Miller djm at mindrot.org
Wed Sep 30 19:45:20 AEST 2020


On Wed, 30 Sep 2020, raf wrote:

> Thanks. That's brilliant.
> It should get a mention in the manpage.
> I've attached a patch for ssh.1.
> 
> However, I've just tried it and it didn't work for me. :-(
> 
>   $ git config core.sshcommand
>   ssh -i ~/.ssh/id_ed25519_github2

Personally, I find it easier to use ~/.ssh/config for this sort of
configuration:

Host github.com
	User git
	IdentityFile ~/.ssh/id_ed25519_github2
	IdentitiesOnly yes # Don't use other keys in agent or on disk

You can then also "ssh -vvv github.com true" to see what is going wrong.

-d


More information about the openssh-unix-dev mailing list