0

I've been trying out emacs as a server, and have run into a problem with magit. We have a Gitlab server at work, and when I try to use magit for a push or a pull, I'm challenged for a password. This doesn't happen when I use git from the command line, and, more importantly, it doesn't happen if I run emacs "directly" (as opposed to running emacsclient with the daemon). I should mention that I'm running on Ubuntu 15.04, and I'm using emacs 25.

I'm wondering if other people have run into this behavior? Or can point me to a remedy? Thanks for your attention!

user888379
  • 1,343
  • 12
  • 30

3 Answers3

2

The suggestions in the existing answers led me to finding a solution. I'm hoping that it will be helpful to others who run into this problem. I'm using systemd to launch the emacs daemon, and it turned out that I needed an additional directive in the emacsd.service file:

[Service]
...
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
...

So, thanks for the leads - they put me on the right track to find the answer.

user888379
  • 1,343
  • 12
  • 30
1

It depends on the protocol used for the upstream repo url.

Typically, a password is asked when ssh doesn't find the proper private/public key in $HOME/.ssh.
And $HOME can differ when a service is launched as a daemon, as opposed to launched by a user.

So if the upstream GitLab repo is accessed by an ssh url, that would explain the difference between the two attempts.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The possible difference in values for $HOME is suggestive. It's funny, though, that other things that I'd expect to be affected (like the contents of my .emacs.d directory) seem to work properly. – user888379 Sep 05 '15 at 15:09
1

You're not the first to have issues with this to say the least. Which is why it is mentioned in the FAQ, which takes you to Pushing with Magit from Windows.

That summarizes the various options and contains troubleshooting instructions. But still not everyone was able to figure it out (or provide accurate enough information for us to diagnose from a distance), so a core contributor wrote a package which makes this work even on insufficiently configured systems. That package is also mentioned on that page.

tarsius
  • 8,147
  • 5
  • 32
  • 46
  • Thanks for the link. I'm not sure it's relevant to my situation. I'm running on LInux, and emacs/magit work fine when I'm not connecting to an emacs server. – user888379 Sep 06 '15 at 17:51