简体   繁体   English

如何让 VSCode Remote - Containers devcontainer 将转发的 SSH 代理用于 Git 凭据?

[英]How do I get a VSCode Remote - Containers devcontainer to use a forwarded SSH Agent for Git credentials?

In Microsoft's docs on sharing git credentials with a devcontainer they state:在 Microsoft 关于与 devcontainer 共享 git 凭据的文档中,他们是state:

the extension will automatically forward your local SSH agent if one is running如果一个正在运行,该扩展将自动转发您的本地 SSH 代理

However:然而:

Locally:本地:

I'm in OSX (Big Sur) and have an ssh agent running.我在 OSX (Big Sur) 中并且正在运行一个 ssh 代理。

ssh-add -l gives: ssh-add -l给出:

256 SHA256:somelongkeyblahblah me@myemail.com (ED25519)

cat ~/.ssh/config gives: cat ~/.ssh/config给出:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

In the remote container:在远程容器中:

echo $SSH_AUTH_SOCK gives: echo $SSH_AUTH_SOCK给出:

/tmp/vscode-ssh-auth-0fa193ba528678ff6157458207dbd1facaa44958.sock

ssh-add -l gives: ssh-add -l给出:

The agent has no identities.

cat ~/.ssh/config gives: cat ~/.ssh/config给出:

/bin/cat: /root/.ssh/config: No such file or directory

and ls -al ~/.ssh gives:ls -al ~/.ssh给出:

total 12
drwxr-xr-x 2 root root 4096 Jul 20 10:29 .
drwx------ 1 root root 4096 Jul 20 10:29 ..
-rw-r--r-- 1 root root  799 Jul 20 10:29 known_hosts

Question问题

Clearly, my ssh agent isn't being "automatically forwarded".显然,我的 ssh 代理没有被“自动转发”。 I'm not very experienced in this area - what's my next move?我在这方面不是很有经验 - 我的下一步是什么? How do I determine if this is due to something I've done, or due to a bug in Remote-Containers?我如何确定这是由于我所做的事情还是由于 Remote-Containers 中的错误?

Just following up because it's been some time since I solved this, but (if memory serves me well) the problem was that my host wasn't set up to do agent forwarding - it was nothing to do with the devcontainer.只是跟进,因为自从我解决这个问题已经有一段时间了,但是(如果 memory 对我很好)问题是我的主机没有设置为进行代理转发 - 这与 devcontainer 无关。

I used these comprehensive instructions to set up agent forwarding and check its functionality .我使用这些综合说明来设置代理转发并检查其功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM