SSH agent forwarding allows you to use private keys stored locally on a remote server.
ssh-add ~/.ssh/id_rsa
on macOS it is advised to use -K
to save it on the Keychain, otherwise this setting isn't persisted
through reboots.
In ~/.ssh/config
:
Host example
ForwardAgent Yes
References: - What is SSH Agent Forwarding and How Do You Use It? - Using SSH agent forwarding