install keychain
sudo apt update
sudo apt install -y keychain
add below to shell rc file
you can change from id_rsa to another private key file name
- bash
echo "eval \"\$(keychain --agents ssh --eval id_rsa -q)\"" >> ~/.bashrc
- zsh
echo "eval \"\$(keychain --agents ssh --eval id_rsa -q)\"" >> ~/.zshrc