Using 1Password with VSCode devcontainers and GitHub
I use SSH for all of my GitHub access. I use 1Password to manage my SSH keys.
This works great when developing in Windows, but the minute you try and use a VSCode devcontainer all hell breaks loose, and nothing works.
Here’s how to fix it.
Step 1: Edit your ~/.ssh/config file
Add the following lines to the config
file:
Host * IdentityAgent “~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock”
This line comes from the 1Password documentation and gets applied to your Windows ~/.ssh/config
file.
Step 2: Rebuild your devcontainer and test it
You must rebuild your devcontainer to ensure the .gitconfig
changes are applied correctly.
After rebuilding the devcontainer launches you should get prompted by 1Password to authenticate for SSH usage. You can also test by running ssh -T [email protected]
and verifying you get prompted and a response saying you have successfully authenticated.
It’s crazy how hard it is to find this info online. I managed to get it working via a Substack post but you shouldn’t have to pay money to find out how to do this. Enjoy!