From 68f151bc7f7b9523a1ec9db659cf238779598232 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Tue, 2 Jul 2019 04:15:59 +0100 Subject: [PATCH] Register newly found socket in agents file. --- .bash_profile | 2 +- .bashrc | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.bash_profile b/.bash_profile index abc72ec..f9227cd 100644 --- a/.bash_profile +++ b/.bash_profile @@ -85,7 +85,7 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && { fi echo } -unset _GOT_LOCK _PLATFORM +unset _PLATFORM # Screen. hash screen >/dev/null 2>&1 && { diff --git a/.bashrc b/.bashrc index ebf2e29..d86c0a1 100644 --- a/.bashrc +++ b/.bashrc @@ -12,8 +12,14 @@ _agent_prompt_command() { SOCK="$(_find_agent_sock)" if ((${PIPESTATUS[0]} == 0)); then export SSH_AUTH_SOCK="$SOCK" + _lock_agents_file && { + if _push_agent_sock; then + echo "Connected to alternate ssh-agent - you may need to re-add keys." + else + echo "Connected to, but failed to register, alternate ssh-agent - you may need to re-add keys." + fi + } _SSH_PROMPT_ERROR_ISSUED=0 - echo "Connected to alternate ssh-agent - you may need to re-add keys." else if [[ -z "$(egrep -v '^$' ~/.ssh/agents)" ]]; then ((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {