File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- if [[ -n " ${SSH_AGENT_PID:- } " ]] && ps -p " $SSH_AGENT_PID " & > /dev/null; then
4
- echo " ~~~ Stopping ssh-agent ${SSH_AGENT_PID} "
5
- ssh-agent -k
6
- fi
3
+ if [[ -n " ${EPHEMERAL_SSH_AGENT_PID:- } " ]] && ps -p " $EPHEMERAL_SSH_AGENT_PID " & > /dev/null; then
4
+ echo " ~~~ Stopping ssh-agent ${EPHEMERAL_SSH_AGENT_PID} "
5
+ SSH_AGENT_PID=" ${EPHEMERAL_SSH_AGENT_PID} " ssh-agent -k
6
+ else
7
+ echo " ~~~ No Ephemeral SSH Agent found"
8
+ fi
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ add_ssh_private_key_to_agent() {
210
210
if [[ -z " ${SSH_AGENT_PID:- } " ]] ; then
211
211
echo " Starting an ephemeral ssh-agent" >&2 ;
212
212
eval " $( ssh-agent -s) "
213
+ export EPHEMERAL_SSH_AGENT_PID=" ${SSH_AGENT_PID} "
213
214
fi
214
215
215
216
echo " Loading ssh-key into ssh-agent (pid ${SSH_AGENT_PID:- } )" >&2 ;
You can’t perform that action at this time.
0 commit comments