Devcontainers Failing to Inherit SSH Keys and Host Environment Variables After Anysphere Extension Migration

Describe the Bug

I’m observing issues while using devcontainers after migrating to anysphere extensions:

  • missing ssh keys passing to devcontainer
  • missing env passing from host to devcontainer

Steps to Reproduce

  1. Connect from Cursor running on MacOS to Ubuntu workstation (on MacOS and Ubuntu zsh as shell is used and ssh-agent is running)
  2. Open git project with devcontainer config

{

"name": "ubuntu",

“image”: “ubuntu:24.04”,

“features”: {

Package features/common-utils · GitHub”: {

“installZsh”: true,

“configureZshAsDefaultShell”: true,

“installOhMyZsh”: true,

“upgradePackages”: false,

“username”: “${localEnv:USER}”

    }

},

“remoteEnv”: {

“MY_ENV”: “${localEnv:MY_ENV}”

},

“containerEnv”: {

“MY_ENV”: “${localEnv:MY_ENV}”

},

“customizations”: {

“vscode”: {

“extensions”: [

“charliermarsh.ruff”,

“ms-azuretools.vscode-docker”,

“ms-python.python”

        \],

“settings”: {

“terminal.integrated.defaultProfile.linux”: “zsh”,

“terminal.integrated.profiles.linux”: {

“zsh”: {

“path”: “/bin/zsh”

                }

            }

        }

    }

},

“remoteUser”: “${localEnv:USER}”

}

  1. Test git fetch - its working
  2. Run presence of env

$ env|grep MY
MY_ENV=foo-bar

  1. Reopen project inside devcontainer
  2. Test git fetch

$ git fetch --all
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ env|grep SSH

  1. Test presence of env

$ env|grep MY
MY_ENV=

Expected Behavior

git fetch --all and env passing work as in MS extension

Operating System

MacOS
Linux

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.3.9
VSCode Version: 1.99.3
Commit: 54c27320fab08c9f5dd5873f07fca101f7a3e070
Date: 2025-08-01T20:07:18.002Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.5.0

anysphere.remote-containers 1.0.22
anysphere.remote-ssh 1.0.23

Does this stop you from using Cursor

Yes - Cursor is unusable

1 Like

Same issue on my end. Works perfectly fine in vanilla VS Code. I usually let VS Code handle forwarding the agent inside the dev container automatically, but this doesn’t seem to be happening in Cursor with the Anysphere’s extensions for SSH and devcontainers.

There’s information in the devcontainer extension changelog that suggests transferring environments to devcontainer should work since version 1.0.20. However, I’m not sure if I have the correct devcontainer.json configuration. Could @condor please help me verify this?

For SSH, I’m using the workaround from another thread. I mount the .ssh directory from the host machine, although I prefer the seamless behavior of VSCode.

    "source=${localEnv:HOME}/.ssh,target=${localEnv:HOME}/.ssh,type=bind",

hi @pawel sure will have a look!

Hi @condor,

Have you had a chance to check the settings for this development container?

cc @ravirahman

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.