add SSH keys in interactive shells

This commit is contained in:
Sami Samhuri 2017-06-08 22:11:28 -07:00
parent a52f1bfcac
commit 22b18854c4
No known key found for this signature in database
GPG key ID: F76F41F04D99808F

12
zshrc
View file

@ -283,10 +283,14 @@ compinit
# 11. SSH Keychain # 11. SSH Keychain
# ================ # ================
if is_interactive && command_exists keychain && [[ -d ~/.ssh ]]; then if is_interactive && command_exists keychain && [[ -d ~/.ssh ]]; then
keychain --nogui ~/.ssh/id_rsa*~*.pub(N) if command_exists keychain; then
KEYCHAINFILE="$HOME/.keychain/$(hostname)-sh" keychain --nogui ~/.ssh/id_rsa*~*.pub(N)
if [[ -f $KEYCHAINFILE ]]; then KEYCHAINFILE="$HOME/.keychain/$(hostname)-sh"
source $KEYCHAINFILE >/dev/null if [[ -f $KEYCHAINFILE ]]; then
source $KEYCHAINFILE >/dev/null
fi
elif command_exists ssh-add; then
ssh-add
fi fi
fi fi