Skip to content

Instantly share code, notes, and snippets.

@JonLevin25
Last active February 26, 2022 13:51
Show Gist options
  • Save JonLevin25/668b0349c067c30206b792131fd14de4 to your computer and use it in GitHub Desktop.
Save JonLevin25/668b0349c067c30206b792131fd14de4 to your computer and use it in GitHub Desktop.
Add all private ssh keys on init
#!/bin/bash
# Find and add _private_ keys
# note- may need adjustments for password-protected keys
eval `ssh-agent -s`
for f in $HOME/.ssh/*; do
fType=`file -b $f`
# echo "$f type: $fType"
if echo $fType | grep -i "private key"; then
ssh-add $f
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment