Fix SSH Agent
This commit is contained in:
parent
21f0c5845e
commit
008c5aabe6
1 changed files with 8 additions and 0 deletions
|
@ -132,12 +132,20 @@ function start-agent {
|
|||
ssh-add "$HOME/.ssh/id_$(nice-hostname)"
|
||||
}
|
||||
|
||||
# If we may have loaded config, let's just check that
|
||||
function test-identities {
|
||||
if ! ssh-add -l > /dev/null; then
|
||||
start-agent
|
||||
fi
|
||||
}
|
||||
|
||||
# Start SSH Agent if it's not already running.
|
||||
#
|
||||
# Also add the id_(nice-hostname) identity.
|
||||
export SSH_ENV="$HOME/.ssh/environment"
|
||||
if [[ -f $SSH_ENV ]]; then
|
||||
. $SSH_ENV > /dev/null
|
||||
test-identities
|
||||
else
|
||||
start-agent
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue