You can use ssh-agent
. The man-page says :
ssh-agent is a program to hold private keys used for public key
authenti‐
cation (RSA, DSA, ECDSA, Ed25519). ssh-agent is usually started in the
beginning of an X-session or a login session, and all other windows or
programs are started as clients to the ssh-agent program. Through use of
environment variables the agent can be located and automatically used for
authentication when logging in to other machines using ssh(1).
On further reading you can see :
The agent initially does not have any private keys. Keys are added
using
ssh-add(1). When executed without arguments, ssh-add(1) adds the files
~/.ssh/id_rsa, ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 and
~/.ssh/identity. If the identity has a passphrase, ssh-add(1) asks for
the passphrase on the terminal if it has one or from a small X11 program
if running under X11. If neither of these is the case then the authenti‐
cation will fail. It then sends the identity to the agent. Several
identities can be stored in the agent; the agent can automatically use
any of these identities. ssh-add -l displays the identities currently
held by the agent.