Created
December 6, 2018 12:53
-
-
Save cfrank/eba6ad303eaf2a28c4862406ec8fe112 to your computer and use it in GitHub Desktop.
Initialize ssh-agent
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
# Functions | |
function init_ssh_keys { | |
echo "Initializing ssh-agent..." | |
eval $(ssh-agent -s) | |
for filename in ~/.ssh/id_rsa*; do | |
# Only want private keys | |
[[ $filename == *.pub ]] && continue | |
kernel=$(uname -s) | |
if [[ $kernel -eq Darwin ]]; then | |
eval $(ssh-add -K $filename) | |
elif [[ $kernel -eq Linux ]]; then | |
eval $(ssh-add $filename) | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment