You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
582 B
Bash
21 lines
582 B
Bash
#!/usr/bin/env bash
|
|
# makes sure agent is active and adds keys
|
|
if [ -z $SSH_AUTH_SOCK ] ; then
|
|
# agent unset
|
|
eval $(ssh-agent -s)
|
|
if [ "$(ssh-add -l)" = "The agent has no identities." ] ; then
|
|
if [ -e ~/.ssh/id_ed25519 ] ; then
|
|
ssh-add ~/.ssh/id_ed25519
|
|
else
|
|
echo -e "No ed25519 keys found! Killing $SSH_AGENT_PID!"
|
|
eval $(ssh-agent -k)
|
|
fi
|
|
else
|
|
echo "Killing $SSH_AGENT_PID!"
|
|
eval $(ssh-agent -k)
|
|
fi
|
|
else
|
|
echo "$SSH_AUTH_SOCK"
|
|
echo "Agent already running at $SSH_AGENT_PID!"
|
|
fi
|