diff options
author | Gibheer <gibheer+git@zero-knowledge.org> | 2025-09-17 16:44:52 +0200 |
---|---|---|
committer | Gibheer <gibheer+git@zero-knowledge.org> | 2025-09-17 16:44:52 +0200 |
commit | 0f8fe066c578d24549dddab4ff51942f8b44b212 (patch) | |
tree | 75bbde0df7038bfda98c290c31b9d431f107eaff /zshrc | |
parent | 5beea6de3133ef98e6121c1a641fa1e128b3902e (diff) |
check if ssh-agent is even running
On some servers the ssh-agent is not running, nor used, so avoid trying
to add any keys.
Diffstat (limited to 'zshrc')
-rw-r--r-- | zshrc | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -37,8 +37,10 @@ export PAGER="less -FXR" # load any SSH keys into the agent export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent/agent.sock" -keys_loaded="$( ssh-add -l | grep 'has no ident' | wc -l )" -if [ "$keys_loaded" -eq "1" ]; then - ssh-add +if [ -f "${SSH_AUTH_SOCK}" ]; then + keys_loaded="$( ssh-add -l | grep 'has no ident' | wc -l )" + if [ "$keys_loaded" -eq "1" ]; then + ssh-add + fi + ssh-add -l fi -ssh-add -l |