I am running emacs in server mode as a systemd user service and want to pull from a pubkey-authenticated remote repository using magit. Unfortunately, magit (or its git child process) cannot use my already loaded public key. Apparently, I cannot connect to my ssh-agent from within the context of emacs.
Run from within emacs:
~ ssh-add
Could not open a connection to your authentication agent.
Is there a known way to solve that issue or do I have to dig into how ssh-agent and clients actually communicate?
ssh-agent
outputs some environment variables (in the form of a sourceable shell script) when it is started. If that agent is still running, and you wrote those settings to a readable file, I believe you should be able to connect to that agent by reading those values into your environment. You can manage that yourself, or use something like keychain. – Athirst