Start ssh agent everywhere.

This commit is contained in:
Bartek Stalewski 2021-09-06 12:37:22 +02:00
parent 605d89896f
commit a3ca6e4701
2 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,9 @@ source $ZDOTDIR/keys.zsh
# aliases
source $ZDOTDIR/aliases.zsh
# ssh
source $ZDOTDIR/ssh.zsh
# plugins & addons
[ -f $XDG_CONFIG_HOME/fzf/fzf.zsh ] && source $ZDOTDIR/fzf.zsh
source $ZDOTDIR/modules/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

6
zsh/ssh.zsh Normal file
View File

@ -0,0 +1,6 @@
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent > "$XDG_CACHE_HOME/ssh-agent.env"
fi
if [[ ! "$SSH_AUTH_SOCK" ]]; then
source "$XDG_CACHE_HOME/ssh-agent.env" >/dev/null
fi