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)"
|
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.
|
# Start SSH Agent if it's not already running.
|
||||||
#
|
#
|
||||||
# Also add the id_(nice-hostname) identity.
|
# Also add the id_(nice-hostname) identity.
|
||||||
export SSH_ENV="$HOME/.ssh/environment"
|
export SSH_ENV="$HOME/.ssh/environment"
|
||||||
if [[ -f $SSH_ENV ]]; then
|
if [[ -f $SSH_ENV ]]; then
|
||||||
. $SSH_ENV > /dev/null
|
. $SSH_ENV > /dev/null
|
||||||
|
test-identities
|
||||||
else
|
else
|
||||||
start-agent
|
start-agent
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue