Skip to content

Instantly share code, notes, and snippets.

@cfrank
Created December 6, 2018 12:53
Show Gist options
  • Save cfrank/eba6ad303eaf2a28c4862406ec8fe112 to your computer and use it in GitHub Desktop.
Save cfrank/eba6ad303eaf2a28c4862406ec8fe112 to your computer and use it in GitHub Desktop.
Initialize ssh-agent
# 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