From d1800d918abbf6e721fc0d03cd939e34dc6840d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Fri, 15 Nov 2024 23:09:32 +0100 Subject: [PATCH] Add an SSH agent --- .config/zsh/.zshrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 0595b90..6387fda 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -32,6 +32,14 @@ if [ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting. . "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 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 + # Aliases [ -f "$MY_CONFIG/.aliases" ] && . "$MY_CONFIG/.aliases"