Files
dots/patches/ssh-agent-location.patch

24 lines
907 B
Diff

diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 83548648..42ec378f 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -24,7 +24,7 @@ function _start_agent() {
# start ssh-agent and setup environment
zstyle -t :omz:plugins:ssh-agent quiet || echo >&2 "Starting ssh-agent ..."
- ssh-agent -s ${lifetime:+-t} ${lifetime} | sed '/^echo/d' >! "$ssh_env_cache"
+ ssh-agent -a /tmp/agent.sock -s ${lifetime:+-t} ${lifetime} | sed '/^echo/d' >! "$ssh_env_cache"
chmod 600 "$ssh_env_cache"
. "$ssh_env_cache" > /dev/null
}
@@ -107,7 +107,8 @@ if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
fi
fi
else
- _start_agent
+ # Don't start new one, if ssh-agent is forwarded
+ [[ $SSH_AUTH_SOCK =~ ^"/tmp/ssh-" ]] || _start_agent
fi
# Don't add identities if lazy-loading is enabled