From 6987a48f8b812f42c69540eefd6c3318665286ed Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Wed, 5 Feb 2020 15:38:15 +0000 Subject: [PATCH] Load ssh key if missing --- roles/home-cli/files/shrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/home-cli/files/shrc b/roles/home-cli/files/shrc index 12a0a16..4ddf0f9 100644 --- a/roles/home-cli/files/shrc +++ b/roles/home-cli/files/shrc @@ -243,6 +243,10 @@ case $- in ;; esac +if test -S $SSH_AUTH_SOCK && test -r $HOME/.ssh/id_rsa && [ $(ssh-add -l | grep "$HOME/.ssh/id_rsa" | wc -l) = 0 ]; then + ssh-add $HOME/.ssh/id_rsa +fi + if [ -r $HOME/.shrc.$(hostname -s) ]; then . $HOME/.shrc.$(hostname -s) fi