Persisting SSH Keys (ssh-agent) across terminals (Windows and Linux)

The easiest way to persist ssh keys across different terminal sessions is to use the keychain tool.

Install keychain

Depending on your operating system, the command will vary

Ubuntu and Debian Derivatives

sudo apt update
sudo apt install keychain

Fedora

sudo dnf install keychain

Arch Linux

sudo pacman -S keychain

Configure Keychain to persist ssh agent

Open /.zshrc or /.bashrc depending on your shell, and add the following entry to it

eval `keychain --eval --agents ssh id_rsa id_rsa_1`

Here, I am adding two keys id_rsa and id_rsa_1.

Next time when you open a terminal, keychain shall ask you for a passphrase (if any passphrase exist for your keys) and that should be it. you are good to go