Last active
January 8, 2020 05:20
-
-
Save Genki-S/88349f3b8a3c150097741ed9ee1a994f to your computer and use it in GitHub Desktop.
Automatically start ssh-agent when necessary, and kill ssh-agent when ssh is done (to not leave many ssh-agent processes around)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh() { | |
if [ -z "$SSH_AGENT_PID" ]; then | |
eval "$(ssh-agent -s)" | |
# ssh-add OTHER_KEYS | |
fi | |
command ssh $@ | |
kill $SSH_AGENT_PID | |
unset SSH_AGENT_PID | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment