summaryrefslogtreecommitdiff
path: root/plugins/ssh-agent
diff options
context:
space:
mode:
authorZikoeng Xi <i@zikoengxi.com>2024-04-23 03:37:17 +0800
committerGitHub <noreply@github.com>2024-04-22 21:37:17 +0200
commit67581c53c6458566e174620361e84b364b9034d2 (patch)
tree644402ac10fc4787668aec4b140ba794d963b309 /plugins/ssh-agent
parent0c80a063c3ad9513b83589d377c501a8d85d63a6 (diff)
downloadzsh-67581c53c6458566e174620361e84b364b9034d2.tar.gz
zsh-67581c53c6458566e174620361e84b364b9034d2.tar.bz2
zsh-67581c53c6458566e174620361e84b364b9034d2.zip
fix(ssh-agent): add identity only if identity exists (#12371)
Diffstat (limited to 'plugins/ssh-agent')
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 77c422ce1..1da54d4dd 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -62,7 +62,7 @@ function _add_identities() {
# if id is an absolute path, make file equal to id
[[ "$id" = /* ]] && file="$id" || file="$HOME/.ssh/$id"
# check for filename match, otherwise try for signature match
- if [[ ${loaded_ids[(I)$file]} -le 0 ]]; then
+ if [[ -f $file && ${loaded_ids[(I)$file]} -le 0 ]]; then
sig="$(ssh-keygen -lf "$file" | awk '{print $2}')"
[[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+=("$file")
fi