Use the ssh-agent service

This commit is contained in:
Rodolphe Bréard 2024-12-15 18:43:22 +01:00
parent f16a62dcd5
commit 228844e6db
No known key found for this signature in database

View file

@ -33,12 +33,8 @@ if [ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.
fi
# SSH agent
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! -f "$SSH_AUTH_SOCK" ]]; then
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fi
# Enable it using `systemctl enable --user ssh-agent.service`
[ -S "$XDG_RUNTIME_DIR/ssh-agent.socket" ] && export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
# Aliases
[ -f "$MY_CONFIG/.aliases" ] && . "$MY_CONFIG/.aliases"