I stumbled upon the fact that Emacs on Windows sets the environment variable DISPLAY to w32 (if the variable is not already set). This causes problems for example with OpenSSH.

What is the use case for setting DISPLAY? Something within Emacs or is it meant for external applications only? Is there an example app that behaves differently?

Can I safely delete the environment variable? (I know I can do this with (setenv "DISPLAY")).

Note: I use native Emacs build emacs-27.0.50-snapshot-2019-09-18-x86_64


I had very similar problems. I ended up leaving the DISPLAY variable at w32. In my user environment I set GIT_SSH=C:\Windows\System32\OpenSSH\ssh.exe. In Emacs ~/.emacs I unset that: (setenv "GIT_SSH").

I don't know why it works, now I can ssh-add from a cmd prompt and vscode works with the agent, and magit works with the agent. I did not specify an sshCommand in ~/.gitconfig.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.