Webstorm on Gateway Doesn't Properly Forward SSH Agent
Hi,
I'm using Gateway with a local machine through SSH. This is the SSH config of my client:
~/.ssh/config
Include ~/.ssh/config.d/common
Include ~/.ssh/config.d/macos
~/.ssh/config.d/common
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa.pub
IdentitiesOnly yes
~/.ssh/config.d/macos
Host *
IdentityAgent ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock
Host workstation
HostName 10.241.218.42
User delucca
IdentityFile ~/.ssh/id_rsa.pub
IdentitiesOnly yes
RemoteForward /run/user/1000/gnupg/S.gpg-agent /Users/delucca/.gnupg/S.gpg-agent.extra
RemoteForward /run/user/1000/gnupg/S.gpg-agent.ssh /Users/delucca/.gnupg/S.gpg-agent.ssh
ForwardAgent yes
ExitOnForwardFailure yes
As you can see, I'm using 1Password as my SSH agent through a socket (following 1Password guide on how to configure it)
Also, this is the config on my host:
~/.ssh/config
Include ~/.ssh/config.d/common
~/.ssh/config.d/common
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa.pub
IdentitiesOnly yes
If I login using my terminal (not on Jetbrains) I can easily run any git command using SSH. When I do so 1Password prompts me to allow the request. It works as expected.
When I login to the machine using Jetbrains Gateway, once I connect to it 1Password prompts me and I am able to open WebStorm (for example). I'm being able to sign commits using GPG, but when I run push or pull it simply doesn't work. I always get this error:
Load key "/home/delucca/.ssh/id_rsa.pub": error in libcrypto git@github.com: Permission denied (publickey). Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
With these details in the console:
18:24:34.659: [www] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/main:main
Load key "/home/delucca/.ssh/id_rsa.pub": error in libcrypto
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I'm already using OpenSSH for my config file parser (both for host and client). Also, I've enabled agent forwarding on settings too.
I've already tried selecting to forward my agent (when I ask to push) and I've also tried to select my pub key. Also, if I try running git pull or push on Jetbrains terminal it also doesn't work (with the same error)
What should I do?
Please sign in to leave a comment.
It turns out the issue was the env var `SSH_AUTH_SOCK`.
I had to set it to 1Password's SSH socket, setting it on my `~/.zshenv` solved the issue.