Ssh authentification in daemon mode


What happened?

If I run emacs in daemon-mode (start emacs daemon and login with systemctl and open a emacsclient), magit is not able to communicate with remote server.

This post ( is basically describing precisely my problem. From what I understand, emacs has (in daemon mode) some problem with loading ssh keys and that’s why magit fails.

In the post they also suggest a solution which I tried to adapt to doom emacs logic:

(package! exec-path-from-shell) ;; in packages.el

(use-package exec-path-from-shell
    (add-to-list 'exec-path-from-shell-variables var))

But afterwards, magit is still responding with the error:

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Do you have any hints for me how to fix this problem? Thanks for your time and help in advance!

Best regards Ludwig

Steps to reproduce

  1. Configure emacs to start at login systemctl --user enable emacs
  2. Reboot && Login
  3. Start emacs emacsclient -c
  4. Open a project with git and ssh authentification at origin
  5. Try magit to fetch updates

System information

Loading data dump...