diff --git a/.bashrc b/.bashrc index 25cea4b..5bb39ea 100644 --- a/.bashrc +++ b/.bashrc @@ -5,6 +5,12 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return +if ! pgrep -u "$USER" ssh-agent > /dev/null; then + ssh-agent > "$XDG_RUNTIME_DIR/ssh-agent.env" +fi +if [[ ! "$SSH_AUTH_SOCK" ]]; then + eval "$(<"$XDG_RUNTIME_DIR/ssh-agent.env")" +fi alias ls='ls --color=auto' alias grep='grep --color=auto'