一応zsh。.zshrcに以下を追記
.zshrc.linux
# -*- mode: shell-script -*-
echo -n "ssh-agent: "
if [ -e ~/.ssh-agent-info ]; then
source ~/.ssh-agent-info
fi
ssh-add -l >&/dev/null
if [ $? = 2 ] ; then
echo -n "ssh-agent: restart...."
ssh-agent >~/.ssh-agent-info
source ~/.ssh-agent-info
fi
if ssh-add -l >&/dev/null ; then
echo "ssh-agent: Identity is already stored."
else
ssh-add
fi