Sublime Forum

SSH only works when started from terminal

#1

Hey,
for some reason pushing via SSH only works when I start sublime-merge via the terminal with the smerge command. When I start it from the gnome menu it doesn’t work: Permission denied (publickey)

I am using a GPG Smartcard for SSH authorization.
And I have found the following differences in the environment variables:

Terminal: SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh
Merge via terminal: SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh
Merge via menu: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

I guess this is the issue. Is there a way to fix that?

0 Likes

#2

Does the Gnome launcher have any button or control for “launch via terminal” or “run in terminal” or similar?

If your terminal has the right environment variables but the launcher isn’t showing them, a potential cause for that is the environment changing while the dock/launcher is still running; it won’t see changes made to the environment while it’s running, and things that it starts would tend to inherit the environment as it sees it.

So, a potential solution might be to try and reboot to make sure that everything is on the same page re: environment settings, if you haven’t already tried that.

0 Likes

#3

Sadly there is no “launch via terminal” option that I could found. :frowning:

0 Likes

#4

I had a similar issue, that I never got round to fixing, in ST3 with the GitSavvy package (which is pretty good), but could never get SSH to work to push to gitlab. (Basically I push from the commandline with a password, not ideal, but it works)

My understanding of these things has improved over the last couple of years, but it’s on my list of things to do/fix. I’ll post back if I get any success, but due to exams, it’ll probably be in a few months time, so apologies, no help now.

0 Likes

#5

This sounds like the differences between the startup scripts for different shell modes. There are various blog posts around with details, my favorite is this one. My guess is moving the env var between .bash_profile & .bashrc alone could do the trick.

As for debugging this issue, take a look at the Help > Debug Information in Sublime Merge and look for a line similar to mine:

environment variables loaded using: /bin/bash -l

This will allow you to see what exactly SM is running to gather env vars such that you can map to flows seen in the blog post above.

0 Likes

How to Set Environment Var for Git
[SOLVED] Pre-commit message hook work from terminal but not from SM