1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 13:50:09 +00:00

feat(ssh-agent): allow lazy-loading SSH identities (#6309)

Fixes #7477
This commit is contained in:
Marc Cornellà 2021-10-11 12:15:47 +02:00
parent 9bd0ac9b00
commit a0ac789f2a
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B
2 changed files with 21 additions and 2 deletions

View file

@ -21,7 +21,23 @@ zstyle :omz:plugins:ssh-agent agent-forwarding on
---- ----
To **load multiple identities** use the `identities` style, For example: To **NOT load any identities on start** use the `lazy` setting. This is particularly
useful when combined with the `AddKeysToAgent` setting (available since OpenSSH 7.2),
since it allows to enter the password only on first use. _NOTE: you can know your
OpenSSH version with `ssh -V`._
```zsh
zstyle :omz:plugins:ssh-agent lazy yes
```
You can enable `AddKeysToAgent` by passing `-o AddKeysToAgent=yes` to the `ssh` command,
or by adding `AddKeysToAgent yes` to your `~/.ssh/config` file [1].
See the [OpenSSH 7.2 Release Notes](http://www.openssh.com/txt/release-7.2).
----
To **load multiple identities** use the `identities` style (**this has no effect
if the `lazy` setting is enabled**). For example:
```zsh ```zsh
zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github

View file

@ -96,7 +96,10 @@ else
_start_agent _start_agent
fi fi
_add_identities # Don't add identities if lazy-loading is enabled
if ! zstyle -b :omz:plugins:ssh-agent lazy; then
_add_identities
fi
unset agent_forwarding ssh_env_cache unset agent_forwarding ssh_env_cache
unfunction _start_agent _add_identities unfunction _start_agent _add_identities