How to avoid macOS for keep asking for the passphrase for key ~/.ssh/id_rsa while remotely operating via ssh?
You need to use ssh-agent to manage your passphrase.

This assumes you have already generated SSH keys to log into your host(s).  If not, see How to SSH in one line for a primer on how to do this.

Next add your key to the agent

ssh-add


If it requires a passphrase, it will ask for it.  Now, every time you SSH to your remote Mac, it won't ask you for the passphrase until you kill the (local) Terminal session.  If you start a new one, it will ask once then remember it for the duration of that Terminal session.

Can you get around having to enter a passphrase at all?  Yes...


Don't put one in.  It's asking because you created a key file with a passphrase.
hard code it into a script (not advisable)


As for going from one Mac, to another and finally out to another server (i.e. GitHub), you will need to enable (set to "yes") ForwardAgent in both your ssh_config and sshd_config.  See this article for more info.