Signing back into the Community for the first time? You'll need to reset your password to access your account.  Find out more.

Forum Discussion

alannza's avatar
alannza
New Contributor
3 days ago

Agent forwarding in VS Code

The ssh agent forwarding documentation states:

The IdentityAgent takes precedence over the SSH_AUTH_SOCK environment variable, so you may want to modify the ~/.ssh/config file for your remote workstation so the IdentityAgent setting is only applied if you're not in an SSH shell.

Match host * exec "test -z $SSH_TTY"
  IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"

This advice works for a normal terminal session (e.g. iTerm -> ssh) but it does not work in the Visual Studio Code integrated terminal. The reason is that VS Code does NOT set the `SSH_TTY` environment variable, so this doesn't match, and so the terminal doesn't use the 1Password agent.

Perhaps the better suggestion would be to test for an ssh client like so?

Match host * exec "test -z '$SSH_CLIENT'"

I can confirm this works both from iTerm and VS Code.

No RepliesBe the first to reply